# (theId)

**URL:** https://forum.kirupa.com/t/theid/149936
**Category:** web dev
**Created:** [June 2, 2005, 11:44am UTC](https://forum.kirupa.com/t/theid/149936 "2005-06-02T11:44:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![reweb](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/reweb/32/135_2.png) [@reweb](https://forum.kirupa.com/u/reweb)
#### Post date: [June 2, 2005, 11:44am UTC](https://forum.kirupa.com/t/theid/149936/1 "2005-06-02T11:44:57Z")

</div>

I am useing this script to change the value of an textfield

```php

<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

```php

<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">&nbsp;
 <input type="text" class="text_r" name="ID1CHK" value="0" size="2"></td></tr></table>
</form>

```

and finaly the CSS

```php

 .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
