474,045 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fire a keypress event

Hi, all

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

jack
Jul 23 '05 #1
6 16111
> 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.fireEven t method, and a document.create Event 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*****@provid ent.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.fireEven t method, and a document.create Event 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.create EventObject(old event)

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

newevent.shiftK ey = false;

Now you'll need to resend it though.

oldevent.srcEle ment.fireEvent( "on"+oldevent.t ype,newevent);

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.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
Jul 23 '05 #7

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

Similar topics

3
7405
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 KeyPressEventHandler(dgGLBatch_KeyPress); but nothing changed. I was wondering wether a custom table and column style might have an effect on how this works???
1
6214
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 the Form.KeyPress event does not trigger anymore. A way to 'solve' this is to set the focus to the form, but during testing it happens ofter the keypress event is not getting triggered on keys like
16
6700
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
4555
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 anything into the textbox (for instance) I trap the keypress event to handle some stuff (i.e. if it is an enter key, etc). Now, once I am done with handling the keypress event for the textbox, I then need to pass that keypress event BACK to the...
5
22739
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
2332
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 statement that's needed to fire this event for the datagrid, text box, list box, etc?
2
19310
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 have created for this purpose is derived from class UserControl.
3
3517
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 them to only allow numbers as inputs. I would like to have the same event fire when pressing keys in each of the text boxes: this.txtCode1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(txtCode_KeyPress);
0
10337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11602
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
12023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
11142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8698
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6652
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.