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 Coder
    Join Date
    Mar 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy frame - document.getElementById

    Hello all,

    function showHideSearch()
    { var colVal;
    var curColVal = top.document.getElementById('main_search_pane').cols;
    if (curColVal=="*,250")
    { curColVal="*,0"; top.document.getElementById('main_body').document.getElementById('main_pane_search').setAttribute('d isplay','visible'); }
    else
    { curColVal="*,250"; top.document.getElementById('main_body').document.getElementById('main_pane_search').setAttribute('d isplay','none'); }
    top.document.getElementById('main_search_pane').setAttribute('cols',curColVal);
    }

    There's the code, so now i'll try explaining what i was trying to accomplish with it:
    I've got a window, with multiple framesets within it. I've got a script (above) running in one of the frames when someone clicks on something (it's being called fine, so that's really irrelevant). What I'm wanting the script to do is access the element wth id="main_search_pane" in the frame titled "main_body", so i can set it's visibility to true.

    FYI: main_body is the id of a frameset. main_search_pane is the id of a div inside main_body.

    please help urgently... i'm really stuck on this, and am nearly at my wits' end.

    Thanks in advance! You ROCK!
    - Vlaad

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    top.frames['main_body'].document.getElementById('main_search_pane').style.display='block';

    you should use frameRef.getAttribute('cols') not frameRef.cols to make it cross-browser compatible
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Mar 2003
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Cheers

    Thanks heaps, glenngv!

    A concise answer that had everything i needed!

    - Vlaad


  •  

    Posting Permissions

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