Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using Firefox 34.0.5

I have tried both setTimeout and focus but it is not working in firefox but all ok with google chrome and IE. I also have cleared browser cache.I am using the following javascript function...

C#
function NonNumericAlert(Id) {
            controls = document.getElementById(Id);
           if (controls.value != Number(controls.value)) {
               alert("Field(s) should be numeric only.");
               //this.controls.focus();
               //setTimeout(controls.focus(), 1);
               //setTimeout(controls.select, 1);
               //setTimeout("controls.focus();", 50);
               setTimeout("this.controls.focus();", 0);
               alert("jhghaghsgh");
               return false;
           }

       }
Posted
Updated 7-Jan-15 19:17pm
v2

1 solution

ok its solved by using this..

C#
function NonNumericAlert(Id) {
            controls = document.getElementById(Id);
           if (controls.value != Number(controls.value)) {
               alert("Field(s) should be numeric only.");
               setTimeout("this.controls.select();", 0);
               setTimeout("this.controls.focus();", 0);
               return false;
           }

       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900