Using JavaScript
Please tell me what else you'll like out here and I will gladly add it. Happy scripting. :)
- More stuff on OnMouseOver as of 17th Dec 1996.
- The History Object as of 20 th Dec 1996.
- Common Questions & Answers as of 23 rd Dec 1996.
- Playing around with SOUND/LIVEAUDIO as of 19 th Jan 1997.
- Controlling SOUND/LIVEAUDIO as of 20 th Jan 1997.
- Animation thro' Javascript as of 3rd Feb 1997.

New site by me on Example 1 : Popping an alert on completion of data entry in a field or pressing a button. USES : onblur and alert

Type your name:

(There's not much use of this popup out here, check the next example for a more practical use.)

Similarly pushing the button would cause an alert to popup
The popups play an important role in conveying a message. For instance the first one could have been used to validate data entered in the field and then pop an alert if there was an error in the data entered. What happens here is that when the user presses the Enter key or tabs out of the input field a function is called which pops up the alert box.
The vague thing about this is the string "JavaScript Alert:" can't figure out why Netscape guys put it out there.

Example 2 : Validating data entered in an input field USES : onblur, alert and indexOf
Type your name:

The code is : <input type="text" name="text1" onblur="valid1(this.form)" value="">
What happens out here is that when the user tabs out or presses ENTER the valid1 function is called. It's code is
function valid1(form) {

  if (form.text1.value == "")
      alert("Please Enter a String");
  else alert("Hi!  "+form.text1.value+"Welcome to JavaScript");
                }
Here the function accepts the form handle and checks if the field is blank. It then pops up a relevant message. This kind of validation is neat as it avoids server side processing and validation using CGI scripts and moreover saves precious bandwidth.
Many sites have forms where users are expected to fill in their email addresses this could also be validated.
Enter your Email address :

<input type=text name="email" value="" onBlur="emailcheck(this.form)">
This code calls the function emailcheck

function emailcheck(form) {
        if (form.email.value == "" || 
              form.email.value.indexOf('@', 0) == -1) 
              alert("No valid e-mail address!");
        else alert("OK!");
                }
You could extend the emailcheck function by checking for the '.' (dot) also.

Example 3 : Displaying messages in the Statusbar USES : onMouseOver and onMouseOut It usually makes good sense to explain what your links are all about check this out. Move your mouse over
this and watch the statusbar. The next link is even better When u move the mouse away from the link the message in the status bar dissappears. Well .... wasn't that cool. The onMouseover event occurs when the cursor goes over the link and that causes the function written out there to execute. which is
window.status='yippeeeeeee....' ----> this writes the text to the statusbar. In the second link as the mouse moves away from the link the onMouseOut event occurs and the function written out there clears the statusbar.


- More stuff on OnMouseOver as of 17th Dec 1996.
- The History Object as of 20 th Dec 1996.
- Common Questions & Answers as of 23 rd Dec 1996.
- Playing around with SOUND/LIVEAUDIO as of 19 th Jan 1997.
- Controlling SOUND/LIVEAUDIO as of 20 th Jan 1997.
- Animation thro' Javascript as of 3rd Feb 1997.

That's all for now I'll keep adding on later. If you need anything specific let me know.


This page is maintained by Sanjay Shetty. I've however stopped responding to email, too many of them :-) thanks for the responses but you probably would be better of posting them at a news group.

U R visitor no .