Any ideas how to achieve this? Trying to set the form name and input name to get value of select box in a form.
<script> function resize(inputname,formname){ value = document.formname.inputname.options[document.formname.inputname.selectedIndex].value; alert(value); } </script>
Fotiman
10:28 pm on Apr 13, 2011 (gmt 0)
You would need to use the array notation:
var el = document[formname][inputname]; var value = el.options[el.selectedIndex].value;
drooh
12:33 am on Apr 14, 2011 (gmt 0)
thanks! do u know of any resource that covers this more in detail?
I found this works too (for the sake of other viewers...looks like the original post)
<script> function resize(formname,inputname){ var input_tfs = document[formname][inputname].options[document[formname][inputname].selectedIndex].value; alert(input_tfs); } </script>