javascript won't work with FireFox

I

Igal

hay. i'm working on some site, the code is pretty old, it has some form
validation JS scripts. but seems like they work only in IE, won't work
with FireFox. here's a example:

<script language="JavaScript" type="text/javascript">
<!--
function check1(){
if (form1.name.value==""){
alert("type your name");
form1.name.focus();
return false;
}
if (form1.mail.value.indexOf("@")==-1){
alert("wrong e-mail");
form1.mail.focus();
return false;
}
if (form1.mail.value.indexOf(".")==-1){
alert("wrong e-mail");
form1.mail.focus();
return false;
}
form1.session_exp.value= "qqq" + form1.name.value + "qqq" +
form1.mail.value + "qqq"
}
//-->
</script>

....<form action="../SendCv/SendCv2.asp" method="post" name="form1"
onsubmit="return check1()">...

what can be wrong with it?
 
A

ASM

Igal a écrit :
hay. i'm working on some site, the code is pretty old, it has some form
validation JS scripts. but seems like they work only in IE, won't work
with FireFox. here's a example:

You can't use (or it is preferable you don't use)
'name' to name an input

Then : what is 'form1' in your function ?
use at least : document.form1

And ... elements of your form have they a name ?
(an id is not a name !)

what can be wrong with it?

see above
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top