Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-14-2006, 04:44 PM   PM User | #1
Chikara
New to the CF scene

 
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Chikara is an unknown quantity at this point
Strange problem with Focus()

http://www.sbts-marketplace.com/Bria...based/java.asp

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.

Code:
function pageJump()
{
	var arr = new Object();
	arr = document.testing.pagejump.selectedIndex;
	alert("The selected value is : " + document.testing.pagejump[arr].value);
	alert(document.testing.pagejump[arr].value);
	var lll = new Object();
	lll = document.testing.pagejump[arr].value;
	alert(lll);
	document.getElementById(lll).focus();
}
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!

Thanks!
Chikara is offline   Reply With Quote
Old 12-14-2006, 05:31 PM   PM User | #2
koyama
Senior Coder

 
koyama's Avatar
 
Join Date: Dec 2006
Location: Copenhagen, Denmark
Posts: 1,246
Thanks: 1
Thanked 5 Times in 5 Posts
koyama will become famous soon enough
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.
koyama is offline   Reply With Quote
Old 12-14-2006, 06:42 PM   PM User | #3
Chikara
New to the CF scene

 
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Chikara is an unknown quantity at this point
Koyama, you are a life saver! This now works correctly. Thank you!
Chikara is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:46 AM.


Advertisement
Log in to turn off these ads.