I am facing some problem with Netscape4.7.The javascript code that works fine in IE?(internet explorer) doesn't work in Netscape.What are the requisite changes to be made in the code so that javascript validation works fine in Netscape4.7.
It gives Javascript error.
The code is as follows
<html>
<head>
<SCRIPT language=JavaScript><!--/******************************************The next section automatically adds '(', ')',and '-' characters to phone number fieldsas the user types (so the user only needsto type the 10 numbers).******************************************/");
function phoneDisplay(i, delKey)
{ if(delKey!=8 && delKey!=46 && delKey!=9 && delKey!=16 && !(delKey>36 && delKey<41))
{
//if the delete, backspace, tab, shift, are not the keys that caused the keyup event.");
var fieldLen = i.value.length;var areaCode = ""; var
exchange ="";
var lastFour = "";var currVal = i.value;var firstParens = 1;
var firstParens = parseInt(i.value.lastIndexOf("(")) + parseInt(1);
var secondParens = 5;var secondParens = parseInt(i.value.lastIndexOf(")")) + parseInt(1);
if(firstParens < 1){ firstParens=1; }
if(secondParens < 1){ secondParens=5; }
if(fieldLen==1 && currVal!="(")
{ areaCode = i.value; }
if(fieldLen>1)
{areaCode = i.value.substring(firstParens,4);}
if(fieldLen>4){exchange = i.value.substring(secondParens,8);}
if(fieldLen>7){lastFour = i.value.substring(9,13);}
//alert("x" + lastFour + "y");");
if(fieldLen<4){i.value = "(" + areaCode ; i.focus();}
elseif(fieldLen<8)
{i.value = "(" + areaCode + ")" + exchange;i.focus();}
elseif(fieldLen<13){i.value = "(" + areaCode + ")" + exchange + "-" + lastFour; i.focus(); } } }
//end if delete key=8,46}");
function phoneBlur(i){
var formName= document.forms[0].name;
if(i.value.length<5)
{i.value="";}}
function phoneFocus(i)
{ var formName = document.forms[0].name;
var formLength =document.forms[0].length;
if((i.value==""))
{i.value="("; i.focus(); i.select(); }
else { i.select(); }}
function testKey(e){
chars="0123456789";
e=window.event;
if(chars.indexOf(String.fromCharCode(e.keyCode))==-1)
window.event.keyCode=0;
}
//-->
</SCRIPT>
<SCRIPT event=onfocus for=telephonenumber1>phoneFocus(this);</SCRIPT>
<SCRIPT event=onfocus for=telephonenumber2>phoneFocus(this);</SCRIPT>
<SCRIPT event=onfocus for=faxnumber>phoneFocus(this);</SCRIPT>
<SCRIPT event=onblur for=telephonenumber1>phoneBlur(this);</SCRIPT>
<SCRIPT event=onblur for=telephonenumber2>phoneBlur(this);</SCRIPT>
<SCRIPT event=onblur for=faxnumber> phoneBlur(this);</SCRIPT>
<SCRIPT event=onkeyup for=telephonenumber1>phoneDisplay(this, window.event.keyCode);</SCRIPT>
<SCRIPT event=onkeyup for=telephonenumber2>phoneDisplay(this, window.event.keyCode);</SCRIPT>
<SCRIPT event=onkeyup for=faxnumber>phoneDisplay(this, window.event.keyCode);</SCRIPT>
</head>
<body>
<form name="NC3" method="get" action="../../CD532_CustomerLocationWizard" onSubmit="return testdata(this)">
<table align=center class="CyDwWizDefaultColour">
<tr>
<td>Telephone Number 1<font color=\"#FF0000\">*</font></td>
<td>
<input type="text" name="telephonenumber1" DATASRC="#osia" DATAFLD="telephonenumber1" maxlength="13" onkeypress="testKey(event)">
</td>
</tr>
</table>
</form>
</body>
</html>