Tenia el siguiente script y me funcionaba en los exploradores IE6,Firefox, Safari pero no en IE8
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Documento sin título</title> <script language="JavaScript"> <!-- var nav4 = window.Event ? true : false; function acceptNum(evt){ // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57 var key = nav4 ? evt.which : evt.keyCode; return (key <= 13 || (key >= 48 && key <= 57)); } //--> </script> </head> <body> <form action="" method="post" name="ej"> <input type="text" name="ini1" value="<? echo $_POST[ini1]; ?>" size="2" maxlength="2" <? echo $Xini1; ?> onKeyPress="return acceptNum(event)" onClick="ej.ini1.value=''"> </form> </body> </html>
Código HTML:
<script type="text/javascript"> String.prototype.reverse=function(){return this.split('').reverse().join('');}; function numberblog(e){ function f(){ this.value=this.value.reverse().replace(/[^0-9.]/g,'').replace(/\.(?=\d*[.]\d*)/g,'').reverse(); } e.onkeyup=f e.onkeydown=f e.onkeypress=f e.onmousedown=f e.onmouseup=f e.onclick=f e.onchange=f e.onblur=f } </script> <form action="" method=""> <input type="text" value="" id="v"> </form> <script type="text/javascript"> numberblog(document.getElementById("v")) </script>
Muchas gracias.