...

View Full Version : frame - document.getElementById



Vlaad
10-23-2003, 08:15 AM
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!

glenngv
10-23-2003, 08:28 AM
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

Vlaad
10-23-2003, 08:37 AM
Thanks heaps, glenngv!

A concise answer that had everything i needed!

:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum