JavaScript Lives in a Web Page


All the code that you write for JavaScript goes into an HTML page. If you don't know HTML yet, you should run out and get a good book on HTML. Lynda and William Weinman's Creative HTML Design.2 (New Riders, 2001) is a good choice for designers and developers. However, assuming that you are familiar with HTML, you should be familiar with the whole concept of a tag language. HTML stands for Hypertext Markup Language. As a markup language, HTML essentially describes a web page as a static entity. A far more challenging endeavor is to program a web page that is dynamic, engaging, and intriguing. That's where JavaScript comes into play.

The most dynamic elements in HTML, beside the link, are event-related attributes. For example, onClick is one of the event-related attributes of HTML. The HTML attribute launches a script when the user clicks on a portion of the page sensitive to a mouse-click action set up by the HTML. However, because HTML itself has no dynamic components, it relies on scripts written in JavaScript. An event-related attribute in HTML is like having a starter on a car with no engine—JavaScript is the engine.

When you have finished an HTML page using solely HTML, the page sits on the screen until you click a link that connects to a separate HTML page, which makes the current page go away.

With JavaScript, you can create pages that make something happen on the page when the person viewing the page takes an action that fires a JavaScript. For example, you might have seen pages that have buttons that change shape or color when the mouse passes over them. That change can be made with a script written in JavaScript and fired by an event-related attribute in HTML: onMouseOver. You are also working on a page that doesn't necessarily have to make server requests. All the interaction is taking place without having to download anything. Depending on the application, this can set the groundwork for instantaneous responsive experiences.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Webworldarticles.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.


This article was sent to us by: George Freedrich at 12272008

Related Articles

1. The ''with'' Statement
Like the ternary conditional operator, the with statement is a shortcut. Instead of having to list all of the properties of an object by repeating the basic objec...

2. Conditional Structures
The "thinking" structure in JavaScript is found in the different types of conditional statements in the language. Used in concert with different types of comparative oper...

3. Types of operators in JavaScript
Assignment Operators The key assignment operator is the equals sign (=). The left operand is a variable, an array element, or an objec...

4. JavaScript Literals
The raw data that make up the root of data types are called "literals." These are, in effect, literally what they represent themselves to be. Numbers, strings, and Boolea...

5. JavaScript Variables
I like to think of variables as containers on a container ship. You can put all different types of content into the containers, move them to another port, empty them, and...

6. JavaScript Operators
Operators can be placed into three categories-binary, unary, and ternary. Binary operators, most commonly associated with the concept of operator, take two (binary) expres...

7. JavaScript Arrays
Because objects are collections of properties with each property having its own name and value, arrays are actually JavaScript objects. Each property in an array is an el...