I want to create a script that prevent users of my form for typeing stupid
things.
Here is my script:
<script language="JavaS cript" type="text/JavaScript">
<!--
function provjera(s1, s2, s3, s4) {
var ime1 = document.formul ar.ime;
var email1 = document.formul ar.email;
var mob1 = document.formul ar.mob;
var izbornik1 = document.formul ar.izbornik;
var obj1 = document.getEle mentById("s1");
var obj2 = document.getEle mentById("s2");
var obj3 = document.getEle mentById("s3");
var obj4 = document.getEle mentById("s4");
if (ime1.value.ind exOf(" ") == -1) {
obj1.style.disp lay = "block";
ime1.focus();
}
else obj1.style.disp lay = "none";
if ((email1.value. indexOf("@") == -1) || (email1.value.i ndexOf(".") == -1))
{
obj2.style.disp lay = "block";
email1.focus();
}
else obj2.style.disp lay = "none";
if (mob1.length == 0) {
obj3.style.disp lay = "block";
mob1.focus();
}
else obj3.style.disp lay = "none";
if (izbornik1.sele ctedIndex == 0) {
obj4.style.disp lay = "block";
izbornik1.focus ();
} else {
obj4.style.disp lay = "none";
document.formul ar.submit(); // Kaze da u ovom redu nesto ne valja
}
}
//-->
</script>
In Firefox it is good but Internet Explorer always want to debug.
He seys:
Line: 62
Error:Object doesn't support this property or method
Please Help m!!!!!
How I fix this??????????
things.
Here is my script:
<script language="JavaS cript" type="text/JavaScript">
<!--
function provjera(s1, s2, s3, s4) {
var ime1 = document.formul ar.ime;
var email1 = document.formul ar.email;
var mob1 = document.formul ar.mob;
var izbornik1 = document.formul ar.izbornik;
var obj1 = document.getEle mentById("s1");
var obj2 = document.getEle mentById("s2");
var obj3 = document.getEle mentById("s3");
var obj4 = document.getEle mentById("s4");
if (ime1.value.ind exOf(" ") == -1) {
obj1.style.disp lay = "block";
ime1.focus();
}
else obj1.style.disp lay = "none";
if ((email1.value. indexOf("@") == -1) || (email1.value.i ndexOf(".") == -1))
{
obj2.style.disp lay = "block";
email1.focus();
}
else obj2.style.disp lay = "none";
if (mob1.length == 0) {
obj3.style.disp lay = "block";
mob1.focus();
}
else obj3.style.disp lay = "none";
if (izbornik1.sele ctedIndex == 0) {
obj4.style.disp lay = "block";
izbornik1.focus ();
} else {
obj4.style.disp lay = "none";
document.formul ar.submit(); // Kaze da u ovom redu nesto ne valja
}
}
//-->
</script>
In Firefox it is good but Internet Explorer always want to debug.
He seys:
Line: 62
Error:Object doesn't support this property or method
Please Help m!!!!!
How I fix this??????????
Comment