Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: checking for nonalpha numeric characters


Message #1 by "Noreen M Masterson" <noreen_masterson@s...> on Mon, 13 Jan 2003 15:08:39
hi

i am trying to check each character entered and make sure it is only an 
alpha-numeric char

function keyCheck(e){
	var keyChar = String.fromCharCode(e.which);
	//here is where u would have to check the key then
}

document.captureEvents(Event.KEYPRESS);
document.onkeypress = keyCheck;

i know in Java u can use char.isLetterorDigit(myString.charAt(index))

but how can this be done in javascript??

thanx

  Return to Index