Skip to content

Instantly share code, notes, and snippets.

@enlacee
Created February 22, 2013 22:14
Show Gist options
  • Save enlacee/5016968 to your computer and use it in GitHub Desktop.
Save enlacee/5016968 to your computer and use it in GitHub Desktop.
Solo numeros en Firefox and IExplorer
<html>
<script type="text/javascript">
var nav4 = window.Event ? true : false;
function IsNumber(event){
// Backspace = 8, Enter = 13, ’0′ = 48, ’9′ = 57, ‘.’ = 46
var key = nav4 ? event.which : event.keyCode;
return (key <= 13 || (key >= 48 && key <= 57) || key == 46);
}
</script>
<body>
<input type="text" name ="name" value="aa" onkeypress="return IsNumber(event)">
</body>
</html>
@enlacee
Copy link
Author

enlacee commented Feb 22, 2013

buena

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment