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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting focus with JavaScript in frames

    Trying to figure out a way to set focus to a particular frame of a website
    using javascript.

    There are 3 frames: a top banner, a menu, and the main display.

    What I want to do is when a link is clicked from the menu, to auto set the
    focus to the main display. The link that is launched loads in the main display
    as it shoud, but the focus is still remains at the menu frame (where the
    click action was performed).

    Thanks,
    Last edited by smittydotbat; 02-23-2005 at 11:40 PM. Reason: [Document editted for clarity]

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try: document.frames['main'].getElementsByTagName('body')[0].focus()

  • #3
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Willy,

    Thanks for the reply.

    Would this be used with the onload method?

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, add it to the onclick event on the menu item that is clicked...

  • #5
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Willy, tried it with the onlick and it didn't work.

    I am going to revisit the code first to make sure that what existed first isn't
    causing the issue.

    Thanks for the support!


  •  

    Posting Permissions

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