View previous topic :: View next topic |
Author |
Message |
tom
Joined: 03 Dec 2004 Posts: 4
|
Posted: Fri Dec 03, 2004 10:56 am Post subject: Adding options to a dropdown with JavaScript? |
|
|
Hi,
I have an ASP page with a dropdown box with several options. I want to add more options to this dropdown without another roundtrip to the server (I want to do it with JavaScript on the client). Is it possible to add dynamically options to a dropdown with JavaScript?
Thanks,
Tom |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Fri Dec 03, 2004 3:29 pm Post subject: |
|
|
Hi Tom and welcome to our forums
To add additional option to a dropdown from JavaScript do the following:
Code: |
document.Your_Form_Name.Your_Dropdown_Name.options[iCount].value = "The Option Value";
document.Your_Form_Name.Your_Dropdown_Name.options[iCount].text = "The Option Text";
|
the iCount is the index of the added option within the dropdown. _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
Missie
Joined: 06 Feb 2006 Posts: 25
|
Posted: Thu Feb 09, 2006 8:13 pm Post subject: |
|
|
I was wondering if you can also change the color?
I can't find it out anywhere.
Also is there any place to download pre- made ones?
I once saw a site with a nice one but i cant quite remember where this was.
Any help would be apreciated |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|