Below is a option and a text box , well basicly what i wanted to do is whenever the user chooses a option , the value would be shown on the text box Wanted output : option = Women suit text box = 4 Hope you guys could help me out. Thanx in advance /* <td width="128"><select size="1" name="cboItem1"> <option selected>None</option> <option value="4">Women Suit</option> </select></td> <td width="71"><input type="text" name="txtItem1UnitPrice" size="7" value="0.00"></td> */
You can use something like this: <html> <head> <script type="text/javascript"> function f_selected(p_index) { var v = document.getElementsByTagName( "option" )[p_index]; document.getElementById("idPrice").value = v.value; } </script> </head> <body> <select size="1" name="cboItem1" onchange="f_selected(this.selectedIndex)"> <option value="" selected="yes">None</option> <option value="1.0">Women Suit</option> <option value="2.5">Men Suit</option> <option value="3.7">Men Hat</option> </select> <input id="idPrice" type="text" name="txtItem1UnitPrice" size="7" value=""/> </body> </html> HTML:
AHHH too late... <form name="my_form"> my_select: <select name="my_select" onchange="window.document.my_form.my_text.value=this.value"> <option></option> <option value="1">The 1st value</option> <option value="2">The 2nd value</option> <option value="3">The 3rd value</option> </select><br /> my_input: <input type="text" name="my_text" /> </form> HTML: