Web Development HTML Guide - Learn HTML
Developer Tutorials
ASP
CGI & Perl
CSS
Flash
HTML
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML



Developer Manuals
Learn HTML
Learn PHP
Learn MySQL
Learn CSS
Learn Pear


Developer Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Developer Resources
Developer Tools
Developer News
Developer Forums
Developer Content
Developer Book Reviews
Survey Software

Web Hosting Directory
Budget Web Hosting
ColdFusion Hosting
Dedicated Servers
Domain Hosting
E-Commerce Hosting
Email Hosting
Free Web Hosting
Linux Web Hosting
Managed Hosting
Reseller Hosting
Small Business Hosting
Windows Web Hosting

Attribute for <SELECT ...>
onChange = "script command(s)"

Looking for information on dropdown menues? See our Dropdown Menu Tutorial.
onChange designates a JavaScript to run when the user chooses one of the options. This means that an action is initiated immediately when the user chooses an item, not when a "submit" button is pressed. A popular use for onChange is to make the <SELECT ...> list a set of hyperlinks. This allows you to display many links in a very compact space:

<FORM>
<SELECT ONCHANGE="location = this.options[this.selectedIndex].value;">
<OPTION VALUE="myhome.html">My Home Page
<OPTION VALUE="myresume.html">Resume
<OPTION VALUE="myhobbies.html">Hobbies
<OPTION VALUE="mydog.html">My Dog
</SELECT>
</FORM>

which gives us

It's usually better to use a submit button instead of onChange. The interface is cleaner if you separate the actions of selecting a destination and of saying "now go". See Drop Down Menu Tutorial for complete code and examples.


Copyright Idocs, Inc. Written by Miko Sullivan











About the NetVisits, Inc Network | Advertise
Developer Tutorials hosted by HostGator.
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: