Entry
how can i get a string which is composed by the checked checkbox's values?
How can i get a string which is composed of the values of the checkboxes checked?
Feb 20th, 2002 06:51
Juergen Thelen, Junssun Lin,
Pretty straightforward, just use the .checked property of the
checkbox input field of your form...
Juergen
--- snip ---
<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT language="JavaScript">
<!--
function ShowIt()
{
var s = document.myform.checkbox.checked ? "checked" : "unchecked";
alert(s);
}
//-->
</SCRIPT>
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000">
<FORM name="myform" method="post" action="">
<INPUT type="checkbox" name="checkbox" value="checkbox" checked>
</FORM>
<BR>
<BR>
<A href="javascript:ShowIt()">Show checkbox state as string</A>
</BODY>
</HTML>
--- snap ---