Jump to content

Change combobox display text [dropdown box]


julius
 Share

Recommended Posts

I would like to change/set the combo box display text dynamicaly using javascript, for example i would like to set "pens" to "rulers" in the html code snippet of a form shown belowi tried to do this using document.formname.Product.index[0].text==rulers but it failed.Can some one please let me know how i can suceed on this*************************************************************<Form name="formname" ><select size="1" name="Product"> <option value="1">Pens</option> <option value="2">Pencils</option> <option value="3">Books</option> <option value="4">Reams</option> <option value="5">Rubbers</option></select> <br>************************************************************

Link to comment
Share on other sites

.text reads/changes what is contained in the current selection, works in IE, FF and Opera :)On this occasion you could use either .text or .innerHTML

Link to comment
Share on other sites

Ok now!I can bind a combox to a field in a table, but how do i bind combobox options (options[0]) to table fields in the database.OrHow do i populate ma combobox with product names/IDs from a database [am using an access databse, javascript, asp and html of course]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...