Re: Not sure

From: Date: Fri, 14 May 2004 10:29:15 +0000
Subject: Re: Not sure
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-186224@lists.php.net to get a copy of this message
Brent Clark wrote:
Hi all I have the following php code: echo"<td>&nbsp;</td><td><input type=\"checkbox\" name=\"frow\" value=\"$var\"></td>\n"; I now have the following javascript code: <!-- From webmin--> <a href='' onClick='document.frm.frow.checked = true; for(i=0; i<document.frm.frow.length; i++) { document.frm.frow[i].checked = true; } return false'>Select all</a>&nbsp; <a href='' onClick='document.frm.frow.checked = !document.frm.frow.checked; for(i=0; i<document.frm.frow.length; i++) { document.frm.frow[i].checked = !document.frm.frow[i].checked; } return false'>Invert selection</a><br>
use <input type="checkbox" name="frow[]" ...> and document.frm.elements['frow[]'][i].checked. And you will get javascript error if you refer to document.frm.frow as both array and object, use typeof operator to find out the type.

« previous php.general (#186224) next »