keypress eventlistener in mozilla firebird

T

Thomas

Hey y'all,

I'm using firebird 0.7 and developed some kind of inline editing with
java script. Therefore I used the keypress event listener. The problem
is that I can only enter one character then the "find as you type"
starts. You can disable it, of course, but what if someone else uses
the web page and hasn't disabled the feature? Do you have an idea how
to disable this feature with javascript? How can I get around this?

Thx for your help, dudes
Bye
Thomas (hope, this isn't silly? it works fine in netscape 7.1)
 
M

Martin Honnen

Thomas said:
I'm using firebird 0.7 and developed some kind of inline editing with
java script. Therefore I used the keypress event listener. The problem
is that I can only enter one character then the "find as you type"
starts. You can disable it, of course, but what if someone else uses
the web page and hasn't disabled the feature? Do you have an idea how
to disable this feature with javascript? How can I get around this?

The DOM allows you to prevent the default action associated with an
event by calling
event.preventDefault()
and indeed with Firebird 0.7 in the following example no find as you
type happens as the event listener calls the above:

<html>
<head>
<title>keypress event listener and find as you type</title>
<script type="text/javascript">
if (document.addEventListener) {
document.addEventListener('keypress',
function (evt) {
var text = document.createTextNode(evt.type + ' with ' +
evt.charCode);
var p = document.createElement('p');
p.appendChild(text);
document.body.appendChild(p);
if (evt.preventDefault) {
evt.preventDefault();
}
},
false
);
}
</script>
</head>
<body>
<ul>
<li><a href="http://JavaScript.faqts.com/">JavaScript.FAQTs</a></li>
<li><a href="http://php.faqts.com/">PHP.FAQTs</a></li>
</ul>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top