473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

fire a keypress event

Hi, all

Is that possible to fire a "tab" key press event with javascript?

jack
Jul 23 '05 #1
6 16077
> Is that possible to fire a "tab" key press event with javascript?

Not that I know of, but what is it you want to accompish with it?
Maybe it can be done in a different way.

Jul 23 '05 #2
I would like to use shift+left as shift+tab and shift+right as tab.

jack
Jul 23 '05 #3
> I would like to use shift+left as shift+tab and shift+right as tab.

There is a object.fireEvent method, and a document.createEvent method..
you could try to manipulate those, but I tried, and I didn't succeed in
emulating a tab or shift-tab.

Jul 23 '05 #4
Thanks Vincent.

I ve tried to change the key code in keyDown event. It will work for
shift+left for shift+tab. For shift+right for tab, because shiftKey property
is readonly, just can't set it to false. So it works as shift+tab as well.
That's the problem!

Jack
"Vincent van Beveren" <vi*****@provident.remove.this.nl> wrote in message
news:40***********************@news.xs4all.nl...
I would like to use shift+left as shift+tab and shift+right as tab.


There is a object.fireEvent method, and a document.createEvent method..
you could try to manipulate those, but I tried, and I didn't succeed in
emulating a tab or shift-tab.

Jul 23 '05 #5
In the event, you can fire a new event.

newevent = document.createEventObject(oldevent)

The new event is a copy of the other event, except for that you
can modify everything.

newevent.shiftKey = false;

Now you'll need to resend it though.

oldevent.srcElement.fireEvent("on"+oldevent.type,n ewevent);

Look at the MSDN for more info
http://msdn.microsoft.com/workshop/a...ventobject.asp
http://msdn.microsoft.com/workshop/a.../fireevent.asp

Something like that.

Though I must admit, I didn't get it to work, this should work (in
theory)

Good luck,
Vincent

datactrl wrote:
Thanks Vincent.

I ve tried to change the key code in keyDown event. It will work for
shift+left for shift+tab. For shift+right for tab, because shiftKey property
is readonly, just can't set it to false. So it works as shift+tab as well.
That's the problem!


Jul 23 '05 #6
Thanks Vincent, I put the following code on "onkeydown".

var my1 = document.createEventObject(event);
my1.keyCode = 9;
my1.shiftKey = true;
event.srcElement.fireEvent("on"+event.type,my1);
event.keyCode = 0;
event.returnValue=false;

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

Jack
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Darryn Ross | last post by:
Hi, I am trying to catch the KeyPress event on my datagrid but it isn't working... i have also tried registering the handler with the event like this... dgGLBatch.KeyPress += new...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
16
by: schneider | last post by:
I can't get any of the Key events to fire in my UserControl. The control only contains a few labels. This is really annoying.. Anyone know whats going on? Thanks, Schneider
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
5
by: Dundealing | last post by:
I have a single button on my form, and when I press the Enter key while a TextBox has focus I want the Button.Click event to fire. Is there a simple way to do this ?
1
by: caryl9999 | last post by:
I'm unable to fire the keypress event using VB.NET. I use Murach's book and have tried the examples provided and still the keypress event doesn't fire. What am I doing wrong? Is there an Import...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
3
by: Christian Blackburn | last post by:
Hi Gang, I have written a product registration screen that has three text boxes. They take 4 numbers each (I know that's too few, but I'm not the originator of this code). In any event I want...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.