Netscape onclick event

by "Derek Lavine" <derek(at)realware.com.au>

 Date:  Wed, 30 May 2001 09:47:51 +1000
 To:  <hwg-languages(at)hwg.org>
 References:  p ci241455a
  todo: View Thread, Original
Hi all,

I have a simple form with some javascript and it all works fine in IE but
Netscape is playing up (or perhaps it is me) anyway the problem with NS is
that the formActionSet method is not being called when I click either the
guest or login graphic on the form. Is there a way I can get this to work,
or is there another approach that will work for both these browsers (and
others)

Thanks very much
Derek

P.S. I know that formActionSet() is not being called in NS as I put an
alert("message") in that function and it did not appear.



<script language="JavaScript">

<!--
function submitForm() {
        if (document.login.action == "../login/login_cmd.cfm"){
                if (document.login.f_userName.value == "") {
                        alert("Please enter your user name");
                        document.login.f_userName.focus();
                        return false;
                }
                if (document.login.f_password.value == "") {
                        alert("Please enter your password");
                        document.login.f_password.focus();
                        return false;
                }
        }
        return true;
}

function formActionSet(obj) {
        if (obj.name == "login"){
                document.login.action = "../login/login_cmd.cfm";
        }
        else {
                document.login.action =
"../site_selection/main_selection.cfm?a_guest=1";
        }
        return true;
}

-->
</script>


<FORM NAME="login" ACTION="login_cmd.cfm" METHOD=POST onSubmit="return
checklogin(this)">
<input type="Text" name="f_userName" required="No" size="12">
<input type="password" name="f_password" style="" required="No" size="12">
<input type="image" name="login" src="login.gif"
onclick="formActionSet(this)">&nbsp;
<input type="image" name="guest" src="guest.gif"
onclick="formActionSet(this)">
</FORM>

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA