Deanna -
Just use an onclick or use an [a href="javascript: unCheckAll()"] [img][/a]
to handle that.
Mike Wokasch
UW-Extension
At 12:47 PM 10/23/2002 -0500, you wrote:
>Hi Folks,
>With the following code, I can check or uncheck all the checkboxes on a page
>IF I use an input type of button. If I use an input type of image, the page
>submits. What gives? (Two different style of looping because of messing
>around with it only.)
>
><SCRIPT LANGUAGE="JavaScript">
><!-- Begin
>function checkAll() {
> var el = document.forms[0].elements;
> for(var i = 0 ; i < el.length ; ++i) {
> if(el[i].type == "checkbox") {
> el[i].checked = true;
> }
> }
>}
>function unCheckAll() {
>var i=0;
>for( i=0 ; i<document.forms[0].elements.length; i++) {
>document.forms[0].elements[i].checked=0;
>}
>}
>// End -->
></script>
>
>These submit the form:
><input type="image" src="images/check.gif" onClick="checkAll();" alt="Check
>All"> <input type="image" src="images/uncheck.gif" onClick="unCheckAll();"
>alt="UnCheck All">
>
>These don't
><input type="button" value="Check All" onClick="checkAll();"> <input
>type="button" value="UnCheck All" onClick="unCheckAll();">
>
>
>Deanna Schneider
>Interactive Media Developer
>[EMAIL PROTECTED]
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm