Jump to content

checkbox id value


solarisuser

Recommended Posts

<script type="text/javascript">

 

function ShowValues()

{

 

checkboxes = new Array()

 

  for (i = 0; i < 4; i++)

  {

    if (document.getElementById("Box" + i).checked == true)

    {

  message = document.getElementById("Box" + i).value

  checkboxes = message

    }

  }

document.write(checkboxes[0])

}

 

 

 

</script>

 

<b>Checkboxes:</b><br/>

<input type="checkbox" id="Box0" name="CheckGroup" value="Item 1"/>This is Item 1<br/>

<input type="checkbox" id="Box1" name="CheckGroup" value="Item 2"/>This is Item 2<br/>

<input type="checkbox" id="Box2" name="CheckGroup"/>This is Item 3<br/>

<br/>

<input type="button" value="Show Values" onclick="ShowValues()"/>

Link to comment
https://forums.phpfreaks.com/topic/47825-checkbox-id-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.