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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select and deselect checkboxes button

Status
Not open for further replies.

ashz

Programmer
Dec 9, 2002
43
ES
Hi,

How can I have a buttons to select and deselect checkboxes?

Thanks.
 
using vbscript:

<HTML>
<HEAD>
<script language=vbscript>
sub clicked()
if check1.checked = true then
check1.checked = false
else
check1.checked = true
end if
end sub
</script>
</head>
<body>
<input type=checkbox name=check1>My Check Box
<BR>
<input type=button onclick=clicked() value=&quot;Click Me&quot; name=button1>
</body>
</html>

hope that helps...
mwa
 
or using javascript:

<HTML>
<HEAD>
<script language=javascript>
<!--
function clicked()
{
if (window.document.form1.check1.checked == true)
{window.document.form1.check1.checked = false;}
else
{window.document.form1.check1.checked = true;}

}
//-->
</script>
</head>
<body>
<form name=form1>
<input type=checkbox name=check1>My Check Box
<BR>
<input type=button onclick=clicked() value=&quot;Click Me&quot; name=button1>
</form>
</body>
</html>

later,
mwa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top