question about createEventObject

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

    question about createEventObject

    Hi, all
    I put the following code on "onkeydown" .

    var my1 = document.create EventObject(eve nt);
    my1.keyCode = 9;
    my1.shiftKey = true;
    event.srcElemen t.fireEvent("on "+event.type,my 1);
    event.keyCode = 0;
    event.returnVal ue=false;

    When I trace it, it does go to fireEvent. But it didn't work as shift+tab.

    Jack


  • Thomas 'PointedEars' Lahn

    #2
    Re: question about createEventObje ct

    datactrl wrote:[color=blue]
    > I put the following code on "onkeydown" .
    >
    > var my1 = document.create EventObject(eve nt);
    > my1.keyCode = 9;
    > my1.shiftKey = true;
    > event.srcElemen t.fireEvent("on "+event.type,my 1);
    > event.keyCode = 0;
    > event.returnVal ue=false;
    >
    > When I trace it, it does go to fireEvent. But it didn't work as shift+tab.[/color]

    From your description I can only guess what you are trying to
    accomplish, so here is my advice:

    Do not try to mess with the user interface. Users expect keys to work
    as they are used to. If they want the functionality of (Shift+)Tab
    (to focus the previous/next interactive element) they will press
    (Shift+)Tab. If they want to submit a form, they will press Enter.
    Besides, your code works in IE only.


    PointedEars

    Comment

    Working...