onMouseOver are a perfect example of an easy to add, rollover
effect script. Move your mouse pointer over the adjacent image
and that event will invert the color by displaying a second image
hyperlink anchor element tag as seen in the following sample of
event handlers specify the image file names.
The next example, added to the body tag, displays an alert window when the page containing the tag opens. The alert contains the message between apostrophes within the parenthesis, which you can customize. Try it. Testing, 1, 2, ...
The write method also permits use of HTML tags within the parenthesis, as seen below.
These two examples explicitly specified the text to be written. You can also include variables you have created. The first two lines below are the portion of the script that creates the variables used in the third line. The plus operator performs the function of combining the elements.
Conditional Statements. A conditional statement is a command that runs only under specified conditions. Conditions require operators. Comparison operators compare two elements and return a Boolean expression, either true or false. Logical operators connect two or more Boolean expressions. Here follows the general syntax of a conditional statement that runs if a condition is met.
This example uses the conditional statement with an else command separating two command blocks, the first of which runs if the condition is met, the other if not.
This conditional statement is a command to break a framed document out of the frame to display in its own window.
The next example is a simple GO TO drop-down menu of hyperlinks. Place the first section of code in the <head> section.
Place this script portion in the <body> section where the form is located. The name of this form must match the name used in the script above in the formHandler function. You can customize the links and their labels, and the number of links.
For your cutting and pasting convenience, the product of the scripted form is presented in a separate file.
The last example creates a text snake that follows your mouse pointer around the page. Go to the page to see it in action and use the page source to view the script.