copia e incollaOriginariamente inviato da Ufotizio
scusa fcaldera, non riesco a capire come relazione questo script al form
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>input numerico</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { (function() { var editingKeys = { '8' : 'backspace', '46' : 'canc', '37' : 'leftarrow', '39' : 'rightarrow' }; $('#inputid').bind('keydown', function(e) { var key = e.keyCode; var keynum = (key > 47) && (key < 58); var keypad = (key > 95) && (key < 106); // tastiera numerica if (!keynum && !keypad) { return (key in editingKeys); } }); })(); }); </script> </head> <body> <input type="text" maxlength="10" id="inputid" /> </body> </html>

Rispondi quotando