keypress eventlistener in mozilla firebird

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas

    #1

    keypress eventlistener in mozilla firebird

    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)
  • Martin Honnen

    #2
    Re: keypress eventlistener in mozilla firebird



    Thomas wrote:
    [color=blue]
    > 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?[/color]

    The DOM allows you to prevent the default action associated with an
    event by calling
    event.preventDe fault()
    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>keypre ss event listener and find as you type</title>
    <script type="text/javascript">
    if (document.addEv entListener) {
    document.addEve ntListener('key press',
    function (evt) {
    var text = document.create TextNode(evt.ty pe + ' with ' +
    evt.charCode);
    var p = document.create Element('p');
    p.appendChild(t ext);
    document.body.a ppendChild(p);
    if (evt.preventDef ault) {
    evt.preventDefa ult();
    }
    },
    false
    );
    }
    </script>
    </head>
    <body>
    <ul>
    <li><a href="http://JavaScript.faqt s.com/">JavaScript.FA QTs</a></li>
    <li><a href="http://php.faqts.com/">PHP.FAQTs </a></li>
    </ul>
    </body>
    </html>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...