kimoo
June 30th, 2007, 12:45 PM
Hello,
function noNumbers(e)
{
var keynum
var keychar
var numcheck
if(window.event) // IE
{
keynum = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which
}
keychar = String.fromCharCode(keynum)
numcheck = /\d/
return !numcheck.test(keychar)
}
</script>
i can understand the whole code except the last 2 lines
numcheck = /\d/
return !numcheck.test(keychar)
what does /\d/ mean and what is !numcheck.text(keychar).. are these some predefined JavaScript stuff..?
any body with an expalination please as this is makiing me crazy
kimoo
function noNumbers(e)
{
var keynum
var keychar
var numcheck
if(window.event) // IE
{
keynum = e.keyCode
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which
}
keychar = String.fromCharCode(keynum)
numcheck = /\d/
return !numcheck.test(keychar)
}
</script>
i can understand the whole code except the last 2 lines
numcheck = /\d/
return !numcheck.test(keychar)
what does /\d/ mean and what is !numcheck.text(keychar).. are these some predefined JavaScript stuff..?
any body with an expalination please as this is makiing me crazy
kimoo