ciao,
questo è il tipico esempi di come le regular expression ti tornano a fagiolo
Potresti usare sulla pressione del carattere, se fa il match con il pattern che ti interessa, qualcosa tipo:
function soloNumeri(e)
{
var keynum;
var checker = new RegExp("\\d");
if(window.event) // IE
{
keynum = e.keyCode;
window.event.returnValue = checker.test(String.fromCharCode(keynum));
}
else if(e.which)
{
// Netscape/Firefox/Opera
keynum = e.which;
return checker.test(String.fromCharCode(keynum));
}
}
Qeusta controlla solo i numeri perche' il patter della regex è "\\d" (ovvero "\d") , a te basta trovare il pattern giusto, ti consiglio di dare un'occhiata a qeusti:
http://regexlib.com/Search.aspx?k=guid
trova quello che ti va meglio, provando a sostituirlo nella funzione js che ti ho scritto sopra...
ciao.
Matteo Raumer
[MCAD .net]
http://blogs.dotnethell.it/freeteo