julius Posted April 19, 2006 Share Posted April 19, 2006 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 More sharing options...
scott100 Posted April 19, 2006 Share Posted April 19, 2006 Something along these linesdocument.formname.Product.options[0].text="rulers"; Link to comment Share on other sites More sharing options...
Chocolate570 Posted April 19, 2006 Share Posted April 19, 2006 Wouldn't it bedocument.formname.Product.options[0].innerHTML="rulers"; Link to comment Share on other sites More sharing options...
scott100 Posted April 19, 2006 Share Posted April 19, 2006 .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 More sharing options...
Chocolate570 Posted April 19, 2006 Share Posted April 19, 2006 Oh, thanks for pointing that out, Scott. Never knew you could use text. I've heard of innerText, just not text Link to comment Share on other sites More sharing options...
julius Posted April 21, 2006 Author Share Posted April 21, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now