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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter works in-line but not as a function

Status
Not open for further replies.

jaschulz

Programmer
May 20, 2005
89
0
0
FR
In the example below, exactly the same code works in IE, Opera and FF when it is called from the HTML, but it fails in FF (only) when it is called as a function. What's going on?

thanks,

JAS

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"
<html>
<head>
<title>Untitled</title>

<script type="text/javascript">

function filterKeys() {
if(event.keyCode){if ((event.keyCode > 32 && event.keyCode < 48) ||
(event.keyCode > 57 && event.keyCode < 65) ||
(event.keyCode > 90 && event.keyCode < 97)) {event.returnValue = false;}
}else{
if ((event.which > 32 && event.which < 48) ||
(event.which > 57 && event.which < 65) ||
(event.which > 90 && event.which < 97)) {return false;}
}
}

</script>

</head>

<body>

Filters: !@#$%^&* (works in both IE, Opera and FF)<br>
<br>
<textarea rows=2 cols=20 id="ta2" onKeypress="
if(event.keyCode){if ((event.keyCode > 32 && event.keyCode < 48) ||
(event.keyCode > 57 && event.keyCode < 65) ||
(event.keyCode > 90 && event.keyCode < 97)) {event.returnValue = false;}
}else{
if ((event.which > 32 && event.which < 48) ||
(event.which > 57 && event.which < 65) ||
(event.which > 90 && event.which < 97)) {return false;}
}
"></textarea><br>
<br>
Filters: !@#$%^&* (works in IE and Opera, but NOT FF!)<br>
<br>
<textarea rows=2 cols=20 id="ta1" onKeypress="filterKeys();">
</textarea>
<br>

</body>
<html>
 
I found the Venkman debugger for FF easily enough, but most of my problems are with IE and Opera, and besides the deprecated MS script debugger, I can't find anything free for IE.

Can you point me to something?

Thanks,

JAS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top