vaibhav_deshmukh

Greenhorn
+ Follow
since Dec 12, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by vaibhav_deshmukh

//SCRIPT FOR IRSTAXID FIELD.THIS SCRIPT PRE-POPULATES THE FIELD WITH A '-' AS THE 4'TH CHARACTER IN THE FIELD.
//IT DOES NOT ALLOW NON-NUMERIC CHARACTER TO BE ENTERED IN THE FIELD.
<SCRIPT language=JavaScript><!--/*********The next section automatically adds '-' characters to IRSTaxId fieldsas the user types (so the user only needs to type the 20 numbers).*******/");
function IRSDisplay(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 = 0;
var firstParens = parseInt(i.value.lastIndexOf("-")) + parseInt(1);
var secondParens = 4; ");
var secondParens = parseInt(i.value.lastIndexOf("-")) + parseInt(1);
if(secondParens < 1){ secondParens=4; }
if(fieldLen==1 && currVal!="-"){ areaCode = i.value; }
if(fieldLen>1 && currVal!="-" ){areaCode = i.value.substring(0,3);}
if(fieldLen>4 ){exchange = i.value.substring(secondParens,20);}
if(fieldLen<4){i.value = areaCode ; i.focus();}
else
if(fieldLen<20){i.value =areaCode +"-"+ exchange;i.focus();}
}
}
function IRSBlur(i){
if(i.value.length<5){

}
function testKey(i,e){
if(i.value.length==3)
chars="0123456789-";
else
chars= "0123456789";
e= window.event;
if(chars.indexOf(String.fromCharCode(e.keyCode))==-1)
window.event.keyCode=0;
}
function testdata(BusName){
if(BusName.BN.value=="") { alert("Please enter Business Name"); return false; }
else return true ;}
if(window.event){
document.NC3.captureEvents(Event.KEYPRESS);
document.NC3.onkeypress=testKey; }//-->
</SCRIPT>
<SCRIPT event=onkeyup for=IRS>IRSDisplay(this, window.event.keyCode);</SCRIPT>

//END OF JAVASCRIPT.
the error which i get after i try this code on Netscape4.7 is
----------------------------------------------------------
JavaScript Error: http://localhost:7001/CD520_CustomerCreationWizard, line 8:
i.select is not a function.
JavaScript Error: http://localhost:7001/CD521_CustomerCreationWizard?D2=0&Next=Next+%3E%3E, line
8:
i.select is not a function.
JavaScript Error: http://localhost:7001/CD521_CustomerCreationWizard?D2=0&Next=Next+%3E%3E, line
144:
window.event has no properties.
how do i get around this problem?
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>