Hi Balaji

Have re-written the code now works.. two problems:

1. checkall() appears to be a reserved function - have renamed function to
checkitall

2. You didn't need to put [] after OptionList in checkbox name

<html>
<head>
<script language="javascript">
function checkitall()
{
var n=0,i=document.form1.OptionList.length;
while(n<i)
{
document.form1.OptionList[n].checked=true;
n=n+1;
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" >
<input type="checkbox" name="OptionList"
value="something1">Option 1</input><br>
<input type="checkbox" name="OptionList"
value="something2">Option 2</input><br>
<input type="checkbox" name="OptionList"
value="something3">Option 3</input><br>
<input type="checkbox" name="checkall"
OnClick="checkitall()"> /////////This is error line
</form>
</body>
</html>

Regards

John

----- Original Message -----
From: "Balaji Ankem" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 04, 2002 12:04 PM
Subject: [PHP] HTML & Java script doubt..


> Hi friend,
>
>  sorry for putting this question to php-list.
>
> Here I am getting the error as "Object doesn't support this property or
> method" in line number 22.
>
> ============================
>
> <html>
> <head>
> <script language="javascript">
> function checkall()
> {
> var n=0,i=document.form1.OptionList.length;
>
> while(n<i)
> {
> document.form1.OptionList[n].checked=true;
> n=n+1;
> }
> }
> </script>
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
> <form name="form1" method="post" >
> <input type="checkbox" name="OptionList[]"
> value="something1">Option 1</input><br>
> <input type="checkbox" name="OptionList[]"
> value="something2">Option 2</input><br>
> <input type="checkbox" name="OptionList[]"
> value="something3">Option 3</input><br>
> <input type="checkbox" name="checkall"
> OnClick=checkall()> /////////This is error line
>
> </form>
> </body>
> </html>
>
> ==================================
>
> Thanks and Regards
> Balaji
>
>


----------------------------------------------------------------------------
----


> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to