View Full Version : Iframe SSI script II with Content Switch Menu problem

08-15-2005, 09:58 PM
Okay, I upgraded to the Iframe SSI script II (http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm) in hopes of solving my issue with sizing the iframe window to fit a Switch Content (http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm) menu, but the SSI script II only resizes the iframe to the size of the collapsed menu and when you try to expand one of the items, it's cut off. Is there a way to either set the page length manually somehow or put a tag around the content in the page so the SSI script II will use the entire document (expanded) to set the window? I'm not great a coding, so I can't figure this out just tinkering with it. Thanks.

08-17-2005, 12:37 AM
The page is here if anyone wants to take a look at it


The page I'm having problems with is the Chaser On-the-Road > On-the-Road Weather

08-17-2005, 07:05 AM
The two scripts do not play well together as, one resizes the iframe onload of the iframe's content page while the other resizes that page onclick. You could reload the switch page onclick (or on use of its main function) but, that will be a drag for slower connections. If you want to go that route anyway, add this code (highlighted red):

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes")
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
if (window.location.reload)
window.location.reload( true );
else if (window.location.replace)
}into the function 'expandcontent' as shown. That should work alright in an iframe like you have it (untested, works on a single page).
Or, you could set the switch script to:

var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)and insert enough white space at the bottom of the switch page so that it will start out tall enough.

08-19-2005, 04:45 AM

10-04-2005, 11:23 PM
I know it's a little late for you now, but this may help others:

function fitIframePoll(){
if (frames["ifr"].document.title != '' && !(!frames["ifr"].document.body))
document.getElementById("ifr").height = frames["ifr"].document.body.getElementsByTagName("TABLE").item(0).scrollHeight + 20;

This works by polling the iframe every 2 seconds to set it's size to the size of a table in the iframe. It worked for me because I knew the iframe would always contain a table tag just after the body. You might need to find a tag that will always be in your pages or figure out how to find the height of the whole document. It's been tested and works in mozilla and IE, but doesn't work for Opera (can't figure out how Opera refers to iframes, I don't know if anyone actually uses it any more anyway).