Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Is this even possible? Number of digits after decimal


Message #1 by chrscote@9... on Thu, 13 Feb 2003 18:10:47
OK, sorry it took so long to get back.  Anyway, I'm trying to make sure 
that a user cannot enter more than one digit after the decimal place.  
Would I place the code from the previous reply within the same function 
that checks to make sure only numeric characters and periods are entered?  
Here is what I have for that function:

function Numkey(){
	//alert(event.keyCode)
	if ((event.keyCode < 48) || (event.keyCode > 57)) {
		if (event.keyCode != 46) 
			event.returnValue = false      
	}     
}

Thanks for the help,
Chris
PS.  This is not a major issue right now, but it would be nice if I could 
do this to ensure correct entries.

  Return to Index