clearing checkboxes

Results 1 to 2 of 2

Thread: clearing checkboxes

  1. #1
    Join Date
    Dec 1969

    Default clearing checkboxes

    I&#039;m working on a page that&#039;s part of a template. The page I&#039;m working on has a Form with several checkboxes that have the same name but different values. The problem I&#039;m having is, the BODY tag is in the header of the template, not in my &#039;body&#039; part. So I can&#039;t use a BODY onLoad call. I tried to get around this by just calling a function called Load() at the end of my page:<BR>.<BR>.<BR>&#060;/form&#062;<BR>&#060;script language="JavaScript"&#062;<BR>load();<BR>&#060;/script&#062;<BR>[end of page]<BR>the function looks like:<BR>function load(){<BR> document.formname.reset();<BR>}<BR>Now, for some reason, when the user uses the Back button from the next page, going back to this page, it does NOT clear the checkboxes. I actually have a couple of other functions in that load() function and they seem to work fine, so I tried going around it by doing:<BR>for (var i=0;i&#060;=document.formname.checkboxesname.lengt h;i++){<BR> document.formname.checkboxesname[i].checked=false;<BR>}<BR>thinking it would just uncheck each checkbox as encountered, whether it is checked or not. But that didn&#039;t seem to do it either.<BR>Is it something with my code, or is the fact that the user is using the Back button preventing me from completely resetting my form?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: clearing checkboxes

    onload doesn&#039;t get called when you navigate back to the page.<BR><BR>use an inline function in a script block after the form. it still may not fire, but it&#039;s worth a try.<BR><BR>j

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts