Salve,
ho provato a modificare il codice di sotto che serve a controllare i caratteri che vengono immessi all'interno di un campo di testo:
codice:
<!--
function getkey(e)
{
if (window.event)
return window.event.keyCode;
else if (e)
return e.which;
else
return null;
}
//-->
<!--
function caratteriok(e, goods)
{
var key, keychar;
key = getkey(e);
if (key == null) return true;
// get character
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();
goods = goods.toLowerCase();
// check goodkeys
if (goods.indexOf(keychar) != -1)
return true;
// control keys
if ( key==null || key==0 || key==8 || key==9
|| key==13 || key==27 )
return true;
// else return false
return false;
}
//-->
Lo script si attiva inserendo onKeyPress="return caratteriok(event,'0123456789.,')" sul campo di testo. Quello che vorrei ottenere è, SE viene digitato il carattere della virgola, questa venga cambiata con il segno del punto.
Grazie per l'aiuto.