Hi,
I have developed a web application in asp.net, i ahve used javascript code for validation, it is working fine in Internet Explorer but it is not working on Mozilla browser.
Any help would be appreciated.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Mar 1, 2011, 11:59 AM
Vijay YadavPosted Mar 2, 2011, 12:03 AM
Thanks for reply its working!!!
Manikavelu VelayuthamPosted Mar 1, 2011, 6:46 AM
http://stackoverflow.com/questions/995183/how-to-allow-only-numeric-0-9-in-html-inputbox-using-jquery
http://stackoverflow.com/questions/302122/jquery-event-keypress-which-key-was-pressed
http://stackoverflow.com/questions/2812585/jquery-validate-characters-on-keypress
You could also look into www.JQuery.com to see how to use jquery in your code.
Vijay YadavPosted Mar 1, 2011, 6:40 AM
Manikavelu VelayuthamPosted Mar 1, 2011, 5:48 AM
Manikavelu VelayuthamPosted Mar 1, 2011, 5:47 AM
You can see the below link, which explains the Javascript different behavior in Cross Browser.
In IE --> keyCode will work, but in Mozillo, it wont.
For Mozilla You need to use as charCode.
http://www.javascriptkit.com/javatutors/javascriptkey2.shtml
Refer this link too to have a clear idea
http://forums.devshed.com/javascript-development-115/event-keycode-problem-in-mozilla-274765.html
http://bytes.com/topic/javascript/answers/648090-event-keycode-9-tab-event-doesnt-work-firefox
Vijay YadavPosted Mar 1, 2011, 4:53 AM
Here is the javascript code that i am using for validation:-
// Phone Validation
function Validate()
{
if (!((event.keyCode >= 48 && event.keyCode <= 57) || event.keyCode == 8 || event.keyCode == 47 || event.keyCode == 45 || event.keyCode == 43))
event.returnValue=false;
}
It works fine in IE but not in Mozilla and Google Chrome.
Any Idea? Please help.
Suthish NairPosted Mar 1, 2011, 3:06 AM
Vijay YadavPosted Mar 1, 2011, 2:15 AM
I have javascript code for validation but it is compatible with IE only not with Mozilla, Google chrome n all.
Any idea regarding that, please help!
sumeet vaityPosted Mar 1, 2011, 12:59 AM
you can use simple javascript code with proper function or else check your css file because most case browser error is get prompted by css file on that text box.
thanks and regards,
Manikavelu VelayuthamPosted Feb 22, 2011, 4:03 AM
If your application will be executed in different browser means, you should use Jquery for client side validation. Thats the only Javascript Validation solution, or else you need to write a seperate code for each browser. Jquery is compatible in all the browsers.