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

focus() problem for radio object in IE

I am trying to use various javascript tools, all of which work in NN, to
work in IE.

Here's my latest annoyance.

I get a list of all objects on a page using

docContents = document.getElementsByTagName("*");
for (var i=0; i < docContents.length; i++) {
if (docContents[i].type == 'text' ||
docContents[i].type == 'textarea' ||
docContents[i].type == 'radio' ||
docContents[i].type == 'checkbox' ||
docContents[i].type == 'select-one' ||
docContents[i].type == 'select') {zmaxv++;}
}

I then select an object to switch focus to. I can use the focus()
method for text objects, select list objects, but not radio buttons.
Why not?

To switch focus, I say

docContents[dCitems[curpos]].focus();

where dCitems contains the position in the array. This works fine, BTW,
for everything but radio objects.

I also tried

document.getElementByName('_sex')[0].focus();

here again I get the problem of the focus not being allowed for this
radio object.
Thoughts? Suggestions?

Jul 20 '05 #1
2 7712
problem fixed

Paul Thompson wrote:
I am trying to use various javascript tools, all of which work in NN, to
work in IE.

Here's my latest annoyance.

I get a list of all objects on a page using

docContents = document.getElementsByTagName("*");
for (var i=0; i < docContents.length; i++) {
if (docContents[i].type == 'text' ||
docContents[i].type == 'textarea' ||
docContents[i].type == 'radio' ||
docContents[i].type == 'checkbox' ||
docContents[i].type == 'select-one' ||
docContents[i].type == 'select') {zmaxv++;}
}

I then select an object to switch focus to. I can use the focus()
method for text objects, select list objects, but not radio buttons. Why
not?

To switch focus, I say

docContents[dCitems[curpos]].focus();

where dCitems contains the position in the array. This works fine, BTW,
for everything but radio objects.

I also tried

document.getElementByName('_sex')[0].focus();

here again I get the problem of the focus not being allowed for this
radio object.
Thoughts? Suggestions?


Jul 20 '05 #2
Your radio buttons are probably double arrays. I had a similar
experience and was not able to access most of the properties of a
radio button until I specified both elements in the double array.
This explains why the first snippet may have trouble, but

document.getElementByName('_sex')[0].focus();

seems like it should work. Have you tried making sure you are
referring to a valid radio button e.g.

alert(document.getElementByName('_sex').length)

length is the one property of a radio button I could access from a
single array.

Hope this helps

Paul Thompson <pa**@wubios.wustl.edu> wrote in message news:<3F**************@wubios.wustl.edu>...
I am trying to use various javascript tools, all of which work in NN, to
work in IE.

Here's my latest annoyance.

I get a list of all objects on a page using

docContents = document.getElementsByTagName("*");
for (var i=0; i < docContents.length; i++) {
if (docContents[i].type == 'text' ||
docContents[i].type == 'textarea' ||
docContents[i].type == 'radio' ||
docContents[i].type == 'checkbox' ||
docContents[i].type == 'select-one' ||
docContents[i].type == 'select') {zmaxv++;}
}

I then select an object to switch focus to. I can use the focus()
method for text objects, select list objects, but not radio buttons.
Why not?

To switch focus, I say

docContents[dCitems[curpos]].focus();

where dCitems contains the position in the array. This works fine, BTW,
for everything but radio objects.

I also tried

document.getElementByName('_sex')[0].focus();

here again I get the problem of the focus not being allowed for this
radio object.
Thoughts? Suggestions?

Jul 20 '05 #3

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

Similar topics

4
by: Paul Thompson | last post by:
How do I determine in JavaScript the name of the object that focus is on?
3
by: Terry Murray | last post by:
Hi All: I would like to know how to set the focus on a radio button (if it is possible) I tried button.focus() but with no luck The reason that I need to do this is to validate a form. If...
2
by: Mike Irwin | last post by:
I'd like to prevent a submit button from getting focus unless a particular textbox or radio button is selected. For example, if a user clicks anywhere within a form, the submit button is focused...
1
by: Anthony | last post by:
Hi, Is there a way to put focus on a form element of type radio or checkbox. It only seems to work on input of type text... Thanks in advance, Anthony
3
by: MarsVoyager | last post by:
Hi, I want to change the value of a submit button when the onChange event is fired by a Radio Input. Problem is, it seems the value is modified in the gui only when the Radio Input looses focus,...
1
by: ewitkop90 | last post by:
<head> <script LANGUAGE="javascript" > function div6yes() { MMDiv6.style.visibility='visible'; framenewinstall.date.focus(); } function div6no() { MMDiv6.style.visibility='hidden'; }...
16
by: Stuart | last post by:
I have a page where I utilise the left and right cursor keys to change an image, also on this page is a groups of radio buttons, unfortunately when a radio button is clicked the focus for the...
5
by: Matt B | last post by:
I know this is a bit of nonstandard behavior, but I would like the Enter key to move focus through a group of radiobuttons without selecting them. The user would then have to use Space or actually...
5
by: baskarpr | last post by:
Could somebody help me ? I have a left frame and right frame in a page. There is a form in right frame which has number of text box, checkbox, radio button, some static text's. For every input item...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
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:
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...

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.