Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!

  • #2
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Koyama, you are a life saver! This now works correctly. Thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •