Hi all, this little problem is driving me completely nuts and I hope someone
can help me. I need to be able to restrict specific text fields to only allow
numerical values to be entered, and specifically whole numbers, no decimals. I
have the following script that works fine in IE
function CheckNumeric()
{
var key
if (window.event)
// Get ASCII value of key that user pressed
key = window.event.keyCode;
else
return true;
// Was key that was pressed a numeric character (0-9)?
if ( key > 47 && key < 58 )
return; // if so, do nothing
else
window.event.returnValue = null; // otherwise, discard character
}
However this does not work in Firefox. I know that it is something to do with
how events are captured in the different browsers but I have tried playing with
the script using my limited knowledge of Javascript and my trusty friend Google
but I just cannot get it right. Can anyone help?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:33:2151
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/33
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:33
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.33
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54