Who can help me to rewrite my javascript file for multiple browsers ? This script does check some field in a form, and if an error has been found displays the form again with the error message beneath the form item the error was found. At IE 5.0 it works ok, wit IE 6.0 I'm getting an error message and Opera does displays the form everytime on the same page, while everytime the form 'reloads' it must be on a blank screen. Who can help me ?
<HTML><HEAD><Title>Registration</title></HEAD><BODY bgcolor=white><SCRIPT language=javascript SRC=http://www.webdeveloper.com/forum/archive/index.php/checkit.js></SCRIPT><form name='formulier' ACTION="../cgi-bin/registratie.cgi" onsubmit="return checkprivate()">
alpha <input type="text" name="veld1"><br>
beta <input type="text" name="veld2"><br>
Calvium <input type="text" name="veld3"><br>
<input type=submit value=http://www.webdeveloper.com/forum/archive/index.php/"Proceed"></form></body></html>
checkit.js:
function checkprivate(){
var Err="";var Err1="";
var Err2="";var Err3="";
if(!datecheck(document.formulier.veld3.value))Err3="(uw geboortedatum als volgt in: dag-maand-jaar. Deze dient 10 cijfers te bevatten, bijvoorbeeld 31-08-1975)<br>";
if(!ValidEmail(document.formulier.veld2.value))Err2="(Vul een geldig e-mail adres in)<br>";
if(!optie1(document.formulier.veld1.value))Err1="(Het veld'gebruikersnaam' is verplicht)<br>";
var Err=Err1+Err2+Err3;
if(Err!=""){
var begin="<html><body bgcolor=white><SCRIPT language=javascript SRC=http://www.webdeveloper.com/forum/archive/index.php/checkit.js></SCRIPT><form name='formulier' ACTION='../cgi-bin/registratie.cgi' onsubmit=return checkprivate()><font color='Darkblue'>Uw ingevoerde gegevens bevat 殚n of meer fouten, deze zijn met witte tekst aangegeven. </font><font color='Black'><br><br>alpha <input type='text' name='veld1' value='http://www.webdeveloper.com/forum/archive/index.php/"+document.formulier.veld1.value+"'><br>"+Err1+"beta<input type='text' name='veld2' value='http://www.webdeveloper.com/forum/archive/index.php/"+document.formulier.veld2.value+"'><br>"+Err2+"Calvium <input type='text' name='veld3' value='http://www.webdeveloper.com/forum/archive/index.php/"+document.formulier.veld3.value+"'><br>"+Err3+"</font><input type=submit value='http://www.webdeveloper.com/forum/archive/index.php/Proceed'></form></body></html>";
document.write(begin);
return false;
}
else
{
return true;
alert(Pass);
}
}
function ValidEmail(str)
{
if ((str==null)||(str=="")) return false
var atpos = str.indexOf("@")
if (atpos<1) return false
var dotpos = str.lastIndexOf(".")
if (dotpos<=atpos+1) return false
return true
}
function datecheck(str)
{
if ((str==null)||(str=="")) return false
if (str.length<10) return false
if (str.length>10) return false
var atpos = str.indexOf("-")
if (atpos<1) return false
var dotpos = str.lastIndexOf("-")
if (dotpos<=atpos+1) return false
return true
}
function optie1(str) {
if ((str==null)||(str=="")) return false
var alpha = ' abcdefghijklmnopqrstuvwxyzî´怃噱ç€腓镱赧螓?';
for (var j=0; j<str.length; j++) {
if (alpha.indexOf(str.charAt(j).toLowerCase()) ==-1) return false;
}
return true
}
<HTML><HEAD><Title>Registration</title></HEAD><BODY bgcolor=white><SCRIPT language=javascript SRC=http://www.webdeveloper.com/forum/archive/index.php/checkit.js></SCRIPT><form name='formulier' ACTION="../cgi-bin/registratie.cgi" onsubmit="return checkprivate()">
alpha <input type="text" name="veld1"><br>
beta <input type="text" name="veld2"><br>
Calvium <input type="text" name="veld3"><br>
<input type=submit value=http://www.webdeveloper.com/forum/archive/index.php/"Proceed"></form></body></html>
checkit.js:
function checkprivate(){
var Err="";var Err1="";
var Err2="";var Err3="";
if(!datecheck(document.formulier.veld3.value))Err3="(uw geboortedatum als volgt in: dag-maand-jaar. Deze dient 10 cijfers te bevatten, bijvoorbeeld 31-08-1975)<br>";
if(!ValidEmail(document.formulier.veld2.value))Err2="(Vul een geldig e-mail adres in)<br>";
if(!optie1(document.formulier.veld1.value))Err1="(Het veld'gebruikersnaam' is verplicht)<br>";
var Err=Err1+Err2+Err3;
if(Err!=""){
var begin="<html><body bgcolor=white><SCRIPT language=javascript SRC=http://www.webdeveloper.com/forum/archive/index.php/checkit.js></SCRIPT><form name='formulier' ACTION='../cgi-bin/registratie.cgi' onsubmit=return checkprivate()><font color='Darkblue'>Uw ingevoerde gegevens bevat 殚n of meer fouten, deze zijn met witte tekst aangegeven. </font><font color='Black'><br><br>alpha <input type='text' name='veld1' value='http://www.webdeveloper.com/forum/archive/index.php/"+document.formulier.veld1.value+"'><br>"+Err1+"beta<input type='text' name='veld2' value='http://www.webdeveloper.com/forum/archive/index.php/"+document.formulier.veld2.value+"'><br>"+Err2+"Calvium <input type='text' name='veld3' value='http://www.webdeveloper.com/forum/archive/index.php/"+document.formulier.veld3.value+"'><br>"+Err3+"</font><input type=submit value='http://www.webdeveloper.com/forum/archive/index.php/Proceed'></form></body></html>";
document.write(begin);
return false;
}
else
{
return true;
alert(Pass);
}
}
function ValidEmail(str)
{
if ((str==null)||(str=="")) return false
var atpos = str.indexOf("@")
if (atpos<1) return false
var dotpos = str.lastIndexOf(".")
if (dotpos<=atpos+1) return false
return true
}
function datecheck(str)
{
if ((str==null)||(str=="")) return false
if (str.length<10) return false
if (str.length>10) return false
var atpos = str.indexOf("-")
if (atpos<1) return false
var dotpos = str.lastIndexOf("-")
if (dotpos<=atpos+1) return false
return true
}
function optie1(str) {
if ((str==null)||(str=="")) return false
var alpha = ' abcdefghijklmnopqrstuvwxyzî´怃噱ç€腓镱赧螓?';
for (var j=0; j<str.length; j++) {
if (alpha.indexOf(str.charAt(j).toLowerCase()) ==-1) return false;
}
return true
}