473,657 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tab jumping to address bar, not next field after select() [IE]

I am using select()/focus() to position the cursor at a particular field
on a form. This works, but when the user presses the Tab key in IE the
cursor jumps to the address bar rather than the next field (Firefox is
fine). Does anyone know why this might be happening and how to stop it?

Below is the code that I use to set the cursor position (it is somewhat
convoluted because it is generated via a series of macros). The cursor
is positioned correctly, but when I hit Tab the cursor does not follow
the expected flow through the page (i.e. it doesn't go to the next field).

// The page contains:
<script language="JavaS cript1.2" type="text/javascript">
<!--
var focusId = 'fnameId';
SafeAddOnload(s etFocus);
//-->
</script>
<input id="fnameId" type="text" size="50" name="fname" value="" />

// From a .js file loaded by the page:
// SafeAddOnload (used above) just delays execution until the
// page has loaded.
// getRef (used below) simply retrieves the DOM object using the id.
//
function setFocus()
{
obj = getRef(focusId) ;
if (obj != null)
try
{
obj.select();
}
catch (e)
{
obj.focus();
}
}

Thanks in advance for any assistance.

Scott
Jul 23 '05 #1
2 11480

Set a tabindex= on your inputs or just 1 input or so, to the tabpress
gets trapped and passed to the tabindex pool, plain html:

<input tabindex="1"> <input tabindex="2">
when the user presses the tab, it'll use 1 and 2 indexed elements for
jumping, leaving out the address box.
Danny
On Wed, 13 Jul 2005 19:27:01 -0700, Scott Eade <se***@westnet. com.au>
wrote:
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #2
Danny wrote:

Set a tabindex= on your inputs or just 1 input or so, to the
tabpress gets trapped and passed to the tabindex pool, plain html:

<input tabindex="1"> <input tabindex="2">
when the user presses the tab, it'll use 1 and 2 indexed elements
for jumping, leaving out the address box.
Danny

Thanks for the suggestion Danny. I had tried using tabindex and it
still misbehaved.

I have just spent a couple more hours on this and have isoated it down
to the setFocus() implementation - specifically to the exception
handling. The following replacement code makes it work:

function setFocus()
{
var obj = getRef(focusId) ;
if (obj != null) {
obj.focus();
if (obj.select)
obj.select();
}
}

Looks like the exception handling in IE is a little screwed up.

Scott
Jul 23 '05 #3

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

Similar topics

3
3756
by: Roger Withnell | last post by:
I have several web sites running the same set of pages and all accessing the same common database tables. A field in all the records contains the web site address of the web site to which each record pertains, for example, this field in some records may contain www.upperbridge.co.uk. When a web site page accesses a database table, it needs to select the records that contain its web site address. How do I identify which web site this page...
8
17041
by: Adam Nemitoff | last post by:
Is is possible to construct a SELECT statement that contains a WHERE clause that uses the value from a column in the "next" row? ie. given a table with a single field named "myField" with the following values I want a SELECT statement that selects the rows "WHERE myField='1' and myField = '2' ": 5 6 1
6
1693
by: Steve Lefevre | last post by:
Hey folks -- I have a series of selectboxes on a web form. I would like to have a javascript jump the focus to the next selectbox when the user presses a key. Each box has the values 1 through 6-9, depending. So normally someone who is used to it can just hit 1 <tab> 3<tab> 5<tab>1<tab>9<tab> -- I'd like to take the tabbing out. So what's really nice is if the box doesn't jump when the user doesn't select a proper value.
3
1745
by: jalkadir | last post by:
By jump I mean ending unexpectedly. The program below, like the jumping beens, has an unusual behaviour. When the noted lines are not present the program terminates disregarding the rest of the lines. I have seen this type of behaviour before, but I can't find to recall the source, the needy greedy source, of the problem. I, however, was able to remember that the problem was resolved, temporarily, by using 'std::cin.get()', but I am...
3
2569
by: scott_baird | last post by:
I have an email macro setup (maybe I should go another way, but that was the quickest at the moment...) and what I would like to do is automate the "to" addressee of the email it generates for sending. What I have is an email button that creates a report based on a property address on a form (driven by a query which has criteria such as forms!frmPROPERTY!address). That open form also has an email address on it for the owner, and I would...
5
4063
by: robecflo | last post by:
Hi Forum, i have a problem, hope somebody can give me ideas. I'm developing with windows forms and vb.net, and oracle as a database. At this moment i have a table called amortizaciones, this table has a field called id_pasivo, which is foreign key to another table called pasivo, a consecutive field called no_cupon and a third field called date. So when i make a query (i.e select * from amortizaciones where id_pasivo = 522 order by...
10
10600
by: H | last post by:
Hi, I have the following address fields in a table: flat_number house_name_or_number street village postal_town county postcode
2
3411
dlite922
by: dlite922 | last post by:
Before traversing my code, here's what my goal is and what this function does: I have a table of fields that dynamically grows as the user enters information. A minimum of 3 rows must always exist. (read the psedo code and comment if you need to know what it does) disregard the debugging , commented alerts. What i'm trying to do is without passing the ID or field that called this function, set the focus to the next element. what's...
1
1630
by: prathna | last post by:
Hi I have this following code <script> function displayFields() { document.getElementById('Label12').style.display = 'none'; document.getElementById('Label13').style.display = 'none'; document.getElementById('Label22').style.display = 'none'; document.getElementById('Label23').style.display = 'none'; } function dispHideFileds() { alert(""); if (document.forms.number.value == 'One') { ...
0
8399
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
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
8504
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
8606
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...
0
7337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
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
4159
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
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
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.