Forum Moderators: open

Message Too Old, No Replies

onchange works for Mozilla, nowhere else

onclick cross-browser

         

DeadAgain

5:45 am on Sep 8, 2003 (gmt 0)

10+ Year Member



I have a cgi script that displays a list of items from a database. I have a checkbox on the page which is displayed by the cgi, and currently it works fine in Mozilla... When I click the checkbox the page is reloaded with the new search parameters in effect. However, this does not work in IE, Opera, or Netscape 4.78. Anyone have any thoughts as to how I can code this to work in all browsers?

Here is my function in the header:

<script language="Javascript">
<!--
function reload_page(){
if (window.location.search == "?showall=1&activeonly=1") {
location='./Status.cgi?showall=1'
} else {
location='./Status.cgi?showall=1&activeonly=1'
}
}
//-->
</script>

and here is where I call the function:

<form method="POST" name="activecheckbox" action="./admin/Admin.cgi" onclick()="reload_page()">
<input TYPE="checkbox" NAME="activeonly" $ActiveCheckBox VALUE="1">Active only
</form>

Note that this is one of three named forms on the page, and that this form, unlike the others, does NOT reside inside a table.

Also, $ActiveCheckBox gets replaced with "CHECKED" if the script is loaded with "./Status.cgi?showall=1&activeonly=1"

Thanks,

Dave A.

DeadAgain

11:44 pm on Sep 9, 2003 (gmt 0)

10+ Year Member



Fixed, with this in the header:

function reload_page(entry){
if (entry === true) {
var option = 1
} else {
var option = 0
}
location="./Status.cgi?showall=1&Active=" + option
}

and this as the form:

<form method="POST" name="activeform" action="" onclick="reload_page(activeform.Active[1].checked)">

<input TYPE="radio" NAME="Active" VALUE="0" CHECKED>Show All <input TYPE="radio" NAME="Active" VALUE="1">Active Only
</form>

Found this approach at [home.cogeco.ca...] after much Googling.

DA