Web Hosting Directory | Web Hosting Resources | Webmaster Resources | Domain Tools | Search Engine Marketing | Forums
  Signup
Today: 127   Yesterday: 1,329   Max: 1,872   Total: 485,035   Current Users : 16 (Member 0) 
DOMAIN TOOLS

WEBMASTER TOOLS

RELATED ARTICLES

SUBMIT AN ARTICLE

Write for us and get publicity, link to your website, and best of all get paid. Please visit our writers page for details.


LINK TO US

Link to us and earn points for each visitor you bring to us. Please visit our link partner page for details.

 

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.php">My Home Page
<OPTION VALUE="myresume.php">Resume
<OPTION VALUE="myhobbies.php">Hobbies
<OPTION VALUE="mydog.php">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 1997-2002 Idocs, Inc. Written by Miko Sullivan.

 
 
 
What is your major source of website traffic?
 
 
 
 
 
 

ADVERTISEMENT

 
Cheap Web HostingBudget Web HostingEcommerce Web Hosting
Link to UsLink ExchangeAdvertisePrivacy PolicyTerms Of ServiceAbout UsContact UsSitemap
Copyright © 2006 - 2008 Broadband Media, Inc. All rights reserved.