Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to filter period (full stop) but not DELETE

Status
Not open for further replies.

jaschulz

Programmer
May 20, 2005
89
FR
I want to filter the period character (.) but I want to allow the use of the DELETE key. However, so far as I can see, they yield the same key code. I am using:

function filterKeys(evt) {
var event=(evt)?evt:window.event;
var thisKeyCode=(event.keyCode)?event.keyCode:event.which;
...

Can anyone show me how to block the period but allow the DELETE key?

Thanks,

JAS
 
What event are you using to call the filterKeys function? I've found that onkeyup / onkeydown, and onkeypress will give different codes for some keys.

Try one of the others for size.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top