473,386 Members | 1,702 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,386 software developers and data experts.

how to control the focus in ids using tab in a loop

i have written this code n using it i am able to control focus in my order.but now i want them to appear in loop.i mean from id 1 to 2,then 3,then again from 3 to 1.thus in a loop.what code should i add????

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Required Field</title>
  4. <script type="text/javascript">
  5.   function testing(event,number) 
  6.     { 
  7.         if( event.keyCode ==9 ) 
  8.         { 
  9.             var wow = document.getElementById(number); 
  10.             wow.focus(); 
  11.         }         
  12.     } 
  13. </script>
  14. </head>
  15. <body onkeydown="if (event.keyCode==13) {event.keyCode=9; return event.keyCode }">
  16. <form>
  17.  <input id="11" type="text" tabindex="1" onkeyup="testing( event, 22)" /> 
  18.           <input id="22" type="text" tabindex="2" onkeyup="testing( event, 33)" /> 
  19.           <input id="33" type="text" tabindex="3" onkeyup="testing( event, 11)" /> 
  20.  
  21.  </form> 
  22. </script>
  23. </body>
  24. </html>
Oct 19 '11 #1
1 1382
acoder
16,027 Expert Mod 8TB
There's a few things wrong with your code. It seems to be IE only for a start. Check out this similar thread which should help: http://bytes.com/topic/javascript/an...y-tab-keypress
Oct 21 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Peter Krikelis | last post by:
Hi, I am trying to develope a User Control Library that features MScomm control. I test my user control in a test application. When I run the application I receive the following: An...
2
by: Elliot M. Rodriguez | last post by:
Is it possible to change a control's focus at runtime? I'm sure you can.... I have a form with 2 textbox controls that cause postbacks. They are located in the middle of my form. When a...
11
by: Lloyd Sheen | last post by:
Is there any one who has actually done this. I have now scanned more web articles about this with the realization that not one of them (including MSDN docs) outlines how to do this. This is...
3
by: Paul | last post by:
Just wondering if there is a way to give a control focus when the page loads, for example so the user could start typing in a text box before clicking on it? Thanks, -- Paul G Software engineer.
3
by: veera | last post by:
Is it possible to give control focus using Asp.net code??
1
by: robin9876 | last post by:
In Asp.Net v1.1 web form I have a number of controls which have the autopostback enabled. Is it possible after the autopostback has run that the control that caused the autopostback to get the...
9
by: Zytan | last post by:
http://msdn2.microsoft.com/en-us/system.windows.forms.control.focus(VS.80).aspx this page says: "Focus is a low-level method intended primarily for custom control authors. Instead, application...
1
by: Ryan | last post by:
Hello, I am starting the use the new ajax.net and I am seeing a bizarre behavior when controlling focus from the codebehind. I have tried: <control>.focus page.setfocus(<control>)...
3
by: nico3334 | last post by:
I'm filling in a Report with SQL data using VB code. I'm using LOOP and MoveNext. Before using MoveNext, I would like to be able to check whether the new data is equal to the previous data that was...
5
by: boss1 | last post by:
hi all, i have a problem with loop in select statement.i m using code : <select name = "s" size = "1" > <option selected>P-Code</option> <option...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.