View Full Version : Strange problem with Focus()

Dec 14th, 2006, 04:44 PM

I'm attempting to use javascript to jump to fieldset tags on that page. Basically, the page is part of a registration form. That page has around 250'ish check boxes. The idea is to use the select feature at the top of the page to quickly jump to a major category. The problem is that it seems to work correctly in IE7 but not FF2. If I change the fieldset tages to anchors, it works in FF2 but not IE7. I'm completely out of ideas on this one. Here is the script that I'm currently working with.

function pageJump()
var arr = new Object();
arr = document.testing.pagejump.selectedIndex;
alert("The selected value is : " + document.testing.pagejump[arr].value);
var lll = new Object();
lll = document.testing.pagejump[arr].value;

Please note the alert()'s are just to make sure that it's looking at the correct element. I'm completely out of ideas here and really appreciate any help!


Dec 14th, 2006, 05:31 PM
While the focus() method was mostly designed for form control elements, IE goes further and supports this method for virtually any element. Therefore IE allows focusing on the fieldset.

As you see, FF doesn't support focusing on a fieldset.

Instead, pick one of the checkboxes within the fieldset you want focus on and use the focus() method on this one.

I'm not a DOM expert... so anyone out there please correct me if I'm wrong.:)

Dec 14th, 2006, 06:42 PM
Koyama, you are a life saver! This now works correctly. Thank you!