Entry
how can i reference a checkbox in a table cell with javascript?
Aug 25th, 2001 03:25
Juergen Thelen, bryan mcgraw,
This is pretty straightforward, just use the .checked property of the
checkbox input field of your form that you've placed in the table cell.
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()
{
alert(document.myform.checkbox.checked);
}
//-->
</SCRIPT>
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000">
<TABLE border="1" cellspacing="3" cellpadding="3">
<TR>
<TD valign="top">checkbox in <td></TD>
<TD>
<FORM name="myform" method="post" action="">
<INPUT type="checkbox" name="checkbox" value="checkbox" checked>
</FORM>
</TD>
</TR>
</TABLE>
<BR>
<BR>
<A href="javascript:ShowIt()">Show checkbox state</A>
</BODY>
</HTML>
--- snap ---