To see each example:-
Click on a link below and load the example in this window.
Then to view the source code:-
Click the right mouse button over the window and then select "View Source" from the pop-up window.
If any graphics are used in the script:-
Click the right mouse button over each graphic and then select "Save Picture As" from the pop-up menu. (All of the graphics are included in the same directory as the javascript example.)
To go back to the Index:-
Click on the "Back" button at the top of your browser.
Alert Button This is probably the simpliest Button JavaScript. Copy 4 lines of HTML into your document and you have a button alert! The button can have different words on it and the message can also be customized.
Apologize Mail This script, when activated, makes the user send an apologetic e-mail - whether they like it or not! Very funny, but has no real use.
Button Link This short script will turn an ordinary button into a link to any page.
Check All Dynamically checks and unchecks all the checkboxes in a form when a button is clicked. Much easier than manually hard-coding the checkbox names, for sure. Updated to only require one button to check and uncheck all boxes.
Click To Submit Prevent the Return key from accidentally submitting a form. The user now MUST click on the submit button.
Directions This effect is practically never used. 6 lines of HTML give you back and forward buttons that act exactly like the ones in your web browser.
Email A JavaScript button will bring up an E-Mail Window for your users. You can also include a predefined subject if you so decide. Both methods are demonstrated.
Fading Button (Internet Explorer Only) Move your mouse over the button and watch it fade to another color and then fade back to original color once you move your mouse off. The message on the button will even change after you click on it!
Headliner Appropriately named the Headliner, it presents a number of messages to your visitors in many different formats including a simple scroll, typewriter, expand, and just static text. Each message when clicked can take the visitor to a different URL!
Image Button Easily create active buttons with any image. Repositions image when your mouse passes over it and moves again when clicked on.
Mrpushme Let JavaScript introduce you to the increasingly popular Mr. Push Me! Mr. Push doesn't mind the occassional push, but watch out if you over do it!
Position Do you not like where window.open() opens your new windows? Using this JavaScript, you can actually have the new window open wherever you want!
R Link Check out this random link generator! It randomly selects a URL from a pre-determined list and sends the user there!
Textarea Use JavaScript to alert your user with the contents of a textarea box! This serves little purpose in the real world, but nonetheless is a great example of JavaScript. Type something in the box and hit Alert Me!
Up Down Box Allows the user to increase and decrease the value in a textbox by clicking up and down buttons. Useful if you would like to allow the user to quickly modify a value in your form.
Window Sizer This is a JavaScript that shows you different window dimensions. It helps you to customize your web pages with the dimensions that best compliment your web site.