Connecting Tech Pros Worldwide Forums | Help | Site Map

javascript won't work with FireFox

Igal
Guest
 
Posts: n/a
#1: Jan 22 '07
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?


Janwillem Borleffs
Guest
 
Posts: n/a
#2: Jan 22 '07

re: javascript won't work with FireFox


Igal wrote:
Quote:
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:
[...]
Quote:
>
http://www.jibbering.com/faq/#FAQ4_13


JW


Igal
Guest
 
Posts: n/a
#3: Jan 22 '07

re: javascript won't work with FireFox


thanks! was very helpful.
ASM
Guest
 
Posts: n/a
#4: Jan 23 '07

re: javascript won't work with FireFox


Igal a écrit :
Quote:
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 !)

Quote:
what can be wrong with it?
see above



--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Closed Thread