Navigation Menu

What's New?
Alphabetical Listing
Site Contents


Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner














Internet.com

IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Developer Channel

FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

Add or change options on a form select menu. Simple script, includes comments.



Add choices 1 and 2
Add choices 3 and 4
Add all choices
Clear all choices

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: addingOptions.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

3. From: Jeremy
Sloppy
06/19/2007 12:53:53

While the general idea is there this code is sloppy because it fails to remove blank entries, but instead only makes them blank. The script should start by clearing all entries (length=0) before writing new ones.

2. From: AsianGrad
02/28/2007 22:07:24

The code is easy to understand, but I would want to add deleting option part to the code. If someone choose 'all choices' and then choose '1&2', the code will still leave '3&4' in it. It could be easily edited by setting those unused options to null.

1. From: Hayhay
02/04/2007 17:44:19

My mom is trying to do something similar.She is trying to make it so you chose something from one dropdown menu, it will change the options in another. I sent her the URL to this script, so she could get a little help.TG for this script.


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.