Live Traffic

Monday, April 25, 2011

Home » » JavaScript Introduction

JavaScript Introduction

JavaScript Introduction

JavaScript Origins


JavaScript was released by Netscape an Sun Microsystems in 1995. However, JavaScript isn't the same thing as Java.

What is JavaScript
  • It's a programming language.
  • It's an interpreted language.
  • It's object-based programming.
  • It's widely used and supported.
  • It's accessible to the beginer.
Uses of JacaScript
  • Use it to add multimedia elements
With JacaScript you can show, hide, change, resize images, and create image rollovers. You can create scrolling text across the status bar.
  • Create pages dynamically
Based on the user's choices, the date, or other external data, JavaScriptcan produce pages that are customized to the user.
  • Interact with the user
It can do some processing of forms and can validate user input when the user submits the form.

Writing JavaScript

JavaScript code is typically embedded in the HTML, to be interpreted and run by the client's browser. Here are some tips to remember when writing JavaScript commads.
  • JavaScript code is case sensitive
  • What space between words and tabs are ignored
  • Line breaks are ignored except within a statement
  • Javascript statements end with a semi-colon ;
The SCRIPT Tag

The  <SCRIPT> tag alerts a browser that JavaScripts code follows. It's typically embedded in thr HTML.

<SCRIPT language="JavaScript">

statements

</SCRIPT>


SCRIPT Example
  • Open "script_tag.html" in a browser.
  • View the source
  • Put the cursor after <!- Enter code below ---> and enter the following :
<SCRIPT language="JavaScript">

alert("Welcome to the script tags test page.")

</SCRIPT>
  • Save the changes by choosing Save from the File menu.
  • Then Refresh the browser by clicking the Refres or Reload button.
Implementing JavaScript

There are three wasy to add JavaScript commands your Web Pages.
  • Embedding code
  • Inline code
  • External file
External File

You can use the SRC attribute of the <SCRIPT> tag to call Java Script code from an external text file. This is 
usefull if you have a lot of code or you want to run in from several pages, because any number of pages can call the same external JavaScript file. The text file itself contains no HTML tags. It's call by the following tag :

<SCRIPT SRC="filename.js">

</SCRIPT>

External Example
  • Open "external.html" in a browser
  • View the Source
  • Put the cursor after <!- Enter code here --> and enter :
<SCRIPT language="JavaScript" SRC="external.js">

</SCRIPT>
  • Save the changes and Refresh the browser.

SEE VIDEO






soyrce vide : www.youtube.com

2 komentar:

hahaha
its very helpful
continue your struggle

you right, i will follow this tutorial

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More