I am useing this script to change the value of an textfield
<script type="text/javascript">
function toggle(box,theId) {
if(document.getElementById) {
var cell = document.getElementById(theId);
if(box.checked) {
cell.className = "on";
document.inputf.ID1CHK.value = "1";
}
else {
cell.className = "off";
document.inputf.ID1CHK.value = "0";
}
}
}
</script>
the HTML code
<form name="inputf" action="yoyo.php" method="post" onsubmit="return checkform(this);">
<table id="ID1CHK"><tr><td>
<INPUT type="checkbox" onclick="toggle(this,'ID1CHK')" name="mycheckbox[]" value="yoyo">
<input type="text" class="text_r" name="ID1CHK" value="0" size="2"></td></tr></table>
</form>
and finaly the CSS
.on {
background-color:#66e0ff;
font-weight: bold;
}
.off {
background-color:white;
font-weight: normal;
}
How can I use (theId) in this line
document.inputf.ID1CHK.value = “1”;
instead of ID1CHK