Karl Blessing
Programmer
I have this function below (some ASP code inside to distinguish what to use if IE or if NS) if I check a checkbox , it will find it , and if a box is selected , it returns true, this works, and my aleart does show true, but if I uncheck a box(when no other boxes are checked), nothing happens, and it never reaches the alert box inside of the function that you see below.
this is an example of an input that trigers it
example (using onclick event)
[ ] [ ] [ ]
to
[X] [ ] [ ]
alerts true
[X] [ ] [ ]
to
[X] [X] [ ]
alerts true
[X] [X] [ ]
to
[X] [ ] [ ]
alerts true
[X] [ ] [ ]
to
[ ] [ ] [ ]
nothing happens, I want to return false if no boxes are chosen.
it will return true if any boxes are chosen, but it will not return false when I uncheck the final checked box.
also the variable maxvar does exist, and in this scenario it's an 8, the names do show ( I did an aleart at one time to show the value of every checkbox being tested, just to be sure it was checking it correctly )
any clues?
Karl Blessing aka kb244{fastHACK}
this is an example of an input that trigers it
Code:
<input type="checkbox" name="rn5695" onclick="alert(refreshtop());">
example (using onclick event)
[ ] [ ] [ ]
to
[X] [ ] [ ]
alerts true
[X] [ ] [ ]
to
[X] [X] [ ]
alerts true
[X] [X] [ ]
to
[X] [ ] [ ]
alerts true
[X] [ ] [ ]
to
[ ] [ ] [ ]
nothing happens, I want to return false if no boxes are chosen.
Code:
function refreshtop()
{
for(var j=0; j<=maxvar; j++)
{
<% if instr(ucase(Request.ServerVariables("HTTP_USER_AGENT")), "MSIE") <> 0 then %>
if (document.all('rn'+reportlst[j]).checked == true)
{
return true;
}
<% else %>
if (document.forms[0]['rn'+reportlst[j]].checked == true)
{
return true;
}
<% end if %>
}
return false;
}
it will return true if any boxes are chosen, but it will not return false when I uncheck the final checked box.
also the variable maxvar does exist, and in this scenario it's an 8, the names do show ( I did an aleart at one time to show the value of every checkbox being tested, just to be sure it was checking it correctly )
any clues?
Karl Blessing aka kb244{fastHACK}
