Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any ideas why I get duplicate alerts in IE, but not Netscape?

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi

I am using the following function (called when a submit image is clicked on) to validate a form:

function validate() {
if (document.login.Cardnum.value =="")
{
alert("Please input your card number.");
return;
}
else if (document.login.PIN.value =="")
{
alert("Please input your PIN number.");
return;
}
document.login.submit();
}

in IE I get the alert boxes popping up twice, while in Netscape it works fine (i.e. only once) any suggestions?

Ben
 
Could you post a link to your page? I tried using it and it worked fine with the following form:

<form name=&quot;login&quot; action=&quot;#&quot; onsubmit=&quot;validate()&quot;>
<input name=&quot;PIN&quot;><input name=&quot;Cardnum&quot;>
<input type=&quot;submit&quot;>
</form>

So I'm not sure why you're havving a rpoblem with this. jared@aauser.com
 
Hi Jared

I really shouldn't post the page's address (company stuff under development), but keep in mind that I am calling it from an OnClick of an image (that may make some difference I guess).

Does that chagne how it works for you?

Ben


<img src=&quot;images/buttons/startdemo.gif&quot; width=&quot;100&quot; height=&quot;44&quot; name=&quot;begin_button&quot; border=&quot;0&quot; align=&quot;middle&quot; alt=&quot;Click Here to Begin&quot; onClick=&quot;validate()&quot;>
 
Just a thought ... does the submit method of the form also call the validate function? If so then you'll be calling the function twice ... fron onClick and submit. Not sure why the difference in IE & Netscape though :-|

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top