...

View Full Version : accessing form elements



athaneumlibrary
04-20-2007, 09:58 AM
i have this form :


<form name="form1" >
<input type="checkbox" name="usedata_193{1}1" id="usedata_193{1}1" value="1"/>
<input type="button" onclick="sameDataSwitch('193{1}1');"/>
</form>


the id on the checkbox has curly braces on it..the problem is i dont know how to access the value of checkbox in javascript..i cant use :
document.form1.usedata_193{1}1 because of the curly braces..are there any ways that i can grab data from elements in a form that has curly braces on their id?

thanks so much

argothian
04-20-2007, 03:18 PM
You can use this, which I'm pretty sure is what one is supposed to use according to w3:

document.getElementById("usedata_193{1}1")



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum