Log in

View Full Version : iframe trouble



scoobidoo
05-03-2006, 03:35 PM
Hi there,
Ill get straight to the problem!
I have a css menu with javascript on the buttons. These are supposed to load my swf files into my iframe... which works fine if you dont press the same button twice. Thats basically my problem. I dont know why its doing that.
Is there a workaround?
I would really appreciate any help with this.
Thanks

PS!
Im not a programmer!

Twey
05-03-2006, 03:51 PM
Is there a workaround?Probably.

djr33
05-03-2006, 05:02 PM
More info? Link? something?

scoobidoo
05-03-2006, 05:56 PM
Hello again,
Thanks for the quick reply... I havent updated my site yet but the javascript on the button is:

<li><a class="" href="./test.swf" onclick="return loadIframe('ifrm', this.href)"></a></li>

The iframe script:
<div class="iframe">
<iframe style="height: 460px;" name="ifrm" id="ifrm" src="./content.htm" frameborder="0" height="100%" scrolling="Auto" width="100%">Sorry, your browser doesn't support iframes.</iframe>
</div>


// JavaScript Document

/*************************************************************************
This code is from Dynamic Web Coding at http://www.dyn-web.com/
See Terms of Use at http://www.dyn-web.com/bus/terms.html
regarding conditions under which you may use this code.
This notice must be retained in the code as is!
*************************************************************************/

function getDocHeight(doc) {
var docHt = 0, sh, oh;
if (doc.height) docHt = doc.height;
else if (doc.body) {
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh, oh);
}
return docHt;
}

function setIframeHeight(iframeName) {
var iframeWin = window.frames[iframeName];
var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
if ( iframeEl && iframeWin ) {
iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
var docHt = getDocHeight(iframeWin.document);
// need to add to height to be sure it will all show
if (docHt) iframeEl.style.height = docHt + 30 + "px";
}
}

function loadIframe(iframeName, url) {
if ( window.frames[iframeName] ) {
window.frames[iframeName].location = url;
return false;
}
else return true;
}

scoobidoo
05-03-2006, 09:45 PM
Hi there,
The problem is fixed now so if anyone has decided to help me out please dont worry... Mainly me that worries!
I can post the code later if anyone wants to see it. Pretty standard though & Im sure most of you guys already know it.

Thanks any way...