J
jeffsnox
Here's the code which I'm saving in an HTML and opening in a Java
enabled browser. It's giving me the following error:
Line: 34
Char: 1
Error: Object Expected
Many thanks in advance for any help.
Code follows:
============================
<html>
<head>
<script language="javascript">
function chkSelectAll(strMatch,frm)
{
for (var i=0; i < frm.elements.length; i++)
{
var form_field = frm.elements;
var field_name = form_field.name;
if (field_name.substring(0,strMatch.length)) == strMatch)
{
if (form_field.type == "checkbox")
{
form_field.checked = true;
}
}
}
}
</script>
</head>
<body>
<form name='bsForm'>
<input type='checkbox' name='chkbox1' />
<input type='checkbox' name='chkbox2' />
<input type='checkbox' name='chkbox3' />
<input type='checkbox' name='chkbox4' />
<input type='checkbox' name='chkbox5' />
</form>
<a href='#' onClick='chkSelectAll("chkbox",document.bsForm);'>CLICK</a>
</body>
</html>
enabled browser. It's giving me the following error:
Line: 34
Char: 1
Error: Object Expected
Many thanks in advance for any help.
Code follows:
============================
<html>
<head>
<script language="javascript">
function chkSelectAll(strMatch,frm)
{
for (var i=0; i < frm.elements.length; i++)
{
var form_field = frm.elements;
var field_name = form_field.name;
if (field_name.substring(0,strMatch.length)) == strMatch)
{
if (form_field.type == "checkbox")
{
form_field.checked = true;
}
}
}
}
</script>
</head>
<body>
<form name='bsForm'>
<input type='checkbox' name='chkbox1' />
<input type='checkbox' name='chkbox2' />
<input type='checkbox' name='chkbox3' />
<input type='checkbox' name='chkbox4' />
<input type='checkbox' name='chkbox5' />
</form>
<a href='#' onClick='chkSelectAll("chkbox",document.bsForm);'>CLICK</a>
</body>
</html>