Sorta new with JavaScript... so don't kill me with jargon.
I am trying to make a script that will only allow text to be inputted into a textarea that is from a drop down menu. My problem is the textarea/textbox id is pre-set and unchangeable by the shopping cart system I use. (*Changing it will make it un-upgradeable in the future)
Here is what I have so far:
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>Dropdown to Textbox</title>
- <script type="text/javascript">
- function setName(child)
- {
- document.all.attrib-1-0.value = child.options[child.selectedIndex].text;
- }
- </script>
- </head>
- <body>
- <select name="name" onchange="setName(this)">
- <option value="001">AJ</option>
- <option value="002">Andrew</option>
- <option value="003">Andy</option>
- </select>
- <input type="text" name="id[txt_1]" size="32" maxlength="32" value="" id="attrib-1-0" />
- </body>
- </html>
Any suggestions?