[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 848
  • Last Modified:

Upon clicking of Tab, focus goes to address bar...

Hi Experts,

I am trying to control the tab key to go to the next textbox...    

However as I focus on my first textbox during OnLoad and then press Tab key, instead of going to my 2nd textbox, it goes to the address bar...

May I ask how to solve this...?   A sample code would be best...


Thanks in advance experts...!   =)
0
aris_datuin
Asked:
aris_datuin
  • 2
  • 2
1 Solution
 
ZylochCommented:
Hi aris_datuin,

Have this:

<input type="text" tabindex="2"> for your second text box, although it should work without that...  

Regards,
Zyloch
0
 
aris_datuinAuthor Commented:
Also, I have another dillemma on how to control th F3 key so that it can call a javascript fuction anytime...   Right now, I have onKeyPressed on my first textbox...   But if the focus is on another object, it is not working unless I also put onKeyPressed on all of my objects...   However, if none of my objects is in focus, how will I control the F3 key...?

Thanks in advance again...!   =)
0
 
ZylochCommented:
Do something like this:

document.onkeyup=handleFT;

function handleFT(e) {
   var key=(window.event)?window.event.keyCode:e.which;
   if (key==114) {//If F3
      //Do this
   }
}
0
 
payalpr2002Commented:
have u used "document.onkeydown" event & "focus()" function in javascript ?
0
 
aris_datuinAuthor Commented:
It is working now...!    Thanks...   =)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now