Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Eval Function

Status
Not open for further replies.

sucram

Programmer
May 23, 2001
75
GB
Hi

i was using this code
eval('document.configForm.' + orderDropDown[0] + '.selectedIndex')
and it worked fine but now I keep getting the error
Error: Expected ';' in IE
and
missing ; before statement.

document.configForm.1893_order.selectedIndex
...................^
in Netscape

Does anyone know what is wrong here. The array holds Strings that refer to a valid drop down menu

Thanks,
Marcus
 
try this:
strng='document.configForm.' + orderDropDown[0] + '.selectedIndex'
alert(strng)
eval(strng)





Known is handfull, Unknown is worldfull
 
Thanks, but that gives the same error.


 
hi,
<form name='asd'>
<input type='text' name='asd1'>
</form>
<script>
sd=&quot;asd1&quot;
eval('document.asd.'+sd+'.value=32')
</script>

this worked for me in both the broswers.

does it help? if not give mu ur code (HTML)

Known is handfull, Unknown is worldfull
 
Your form field name is &quot;1893_order&quot;. You can't have a form field name that begins with a number.

Also, you don't need to use eval. You can do this:
document.configForm[orderDropDown[0]].selectedIndex

Adam
while(woman.width>woman.height && wallet.value>0){beer++;vision.blur()};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top