Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-05-2004, 01:23 AM   PM User | #1
kommidi
New to the CF scene

 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kommidi is an unknown quantity at this point
works on Internet Explorer not on Mozilla

I have a function that validates the input onChange().In case of an error the function gives an alert message and keeps the focus on the same text box.I achieve this by the following snippet of code in the function using
if (alertbox!="") {alert(alertbox); entered.select(); entered.focus();
This worlks on Internet Explorer but does not on mozilla...

Please Help me on this....

Thanks

In case I am not clear I am attaching the code and the function call

Fuunction Call:
onChange="return numberValidation(this,1,10,'The Number Of Elements should be an Integer within the Range ','Integer'

Function

function numberValidation(entered, min, max, alertbox, datatype)
{
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i")
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox); entered.select(); entered.focus();
} return false;}
else {return true;}
}
}
kommidi is offline   Reply With Quote
Old 02-05-2004, 01:52 AM   PM User | #2
Antoniohawk
Senior Coder

 
Join Date: Aug 2002
Location: Kansas City, Kansas
Posts: 1,518
Thanks: 0
Thanked 2 Times in 2 Posts
Antoniohawk will become famous soon enough
I don't think that onChange is supported by mozilla... Not sure, but I heard that somewhere.
Antoniohawk is offline   Reply With Quote
Old 02-05-2004, 02:22 AM   PM User | #3
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
I don't think so. Check if there are errors in Javascript console
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:36 AM.


Advertisement
Log in to turn off these ads.