borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (How to open a window by javascript in the center of the screen?)Next Topic (how to show images after compression ?) New Topic New Poll Post Reply
AndreaVB Forum : ASP.Net : Need crossbrowser javascript for numeric textbox ?
Poster Message
tri_inn
Level: Regular User
Registered: 26-08-2002
Posts: 395

icon Need crossbrowser javascript for numeric textbox ?

i have developed a numeric textbox web server control. it generates javascript when form load but
my javascript only works in IE browser. so please give me the same javascript which will work in
IE & Netscape.

here i am giving my javascript which is generated by my control

<script language=JavaScript>
function DoCheck_NumBox1(event)
{
var negative;
var Decimal = 46;
var DeciPlaces =2;
var AllowNegative =true;
var myString = new String(event.srcElement.value);
var pntPos = myString.indexOf(String.fromCharCode(Decimal));
var keyChar = window.event.keyCode;
if (AllowNegative==true)
{negative=myString.indexOf('-');
if (negative = -1)
{
if (myString.length <= 0)
return true;
}
else
{
return false;
}
}
if (keyChar == Decimal)
{
if (pntPos != -1)
{
return false;
}
else
{
if(DeciPlaces <=0)
{
return false;
}
else
{
return true;
}
}
}
if ((keyChar < 48) || (keyChar > 57))
{
return false;
}
else
{
if (pntPos != -1)
{
if ((myString.length - (pntPos + 1)) >= DeciPlaces)
return false;
}
else
{
return true;
}
}
}
</script>


10-09-2004 at 05:24 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : ASP.Net : Need crossbrowser javascript for numeric textbox ?
Previous Topic (How to open a window by javascript in the center of the screen?)Next Topic (how to show images after compression ?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder