[Javascript] <select>

Peter-Paul Koch gassinaumasis at hotmail.com
Wed Sep 4 09:23:00 CDT 2002


>From: "Mckinney, Lori K" <lkmckinn at ingr.com>
>Reply-To: javascript at LaTech.edu
>To: javascript at LaTech.edu
>Subject: RE: [Javascript] <select>
>Date: Wed, 4 Sep 2002 08:36:56 -0500
>
>You need to first create an option element
>	var optionElement=document.createElement("OPTION");
>	optionElement.value=value;
>	optionElement.text=display;
>
>  then add it to the select
>	selectElement.add(optionElement,index);
>
>The second argument to the add is the index indicating where you want to 
>put the option in the select.  If you don't include it it, the option will 
>be added to the end of the options collection.  If you use 0, it will be 
>the first thing in the list.

In this specific case createElement does not work in Explorer on Mac. For a 
completely cross-browser compatible script (even going back to NN3) see 
http://www.xs4all.nl/~ppk/js/index.html?options.html

ppk

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx




More information about the Javascript mailing list