I need help doing extenable iframe could someone give me a tutorial on this please or can someone help!![]()

I need help doing extenable iframe could someone give me a tutorial on this please or can someone help!![]()
Hey there,
There's no tutorial needed to make an expandable iframe. You have to get a Javascript code and insert it just before your iframe code.
Code:<script type="text/javascript"> //<![CDATA[ window.onload = function() { var f = document.getElementById("mainframe"); function resize() { var h = ""; var w = ""; if (f.contentDocument) { h = f.contentDocument.documentElement.offsetHeight + 20 + "px"; // can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width"); } else if (f.contentWindow) { h = f.contentWindow.document.body.scrollHeight + 5 + "px"; } else { return; } f.setAttribute("height",h); f.parentNode.setAttribute("height",h); } if (window.addEventListener) { f.onload = resize; } else if (f.attachEvent) { f.attachEvent("onload", resize); } else { return; } resize(); } //]]> </script>
Just remember to name your iframe mainframe otherwise it won't work
Last edited by alarmclock; 24-12-2006 at 02:27 PM.
Hmm.. soo then my iframe html will be <iframe src="main.html" name="mainframe" width="" height="" frameborder="0"></iframe> ??
yup
put id="mainframe" in there aswell, after name="mainframe"
am really confuse atm >____< LOOL can you show me a example?
thinkhabbo used to have it.
first you need a layout capable of expanding.
Code:<script type="text/javascript"> //<![CDATA[ window.onload = function() { var f = document.getElementById("mainframe"); function resize() { var h = ""; var w = ""; if (f.contentDocument) { h = f.contentDocument.documentElement.offsetHeight + 20 + "px"; // can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width"); } else if (f.contentWindow) { h = f.contentWindow.document.body.scrollHeight + 5 + "px"; } else { return; } f.setAttribute("height",h); f.parentNode.setAttribute("height",h); } if (window.addEventListener) { f.onload = resize; } else if (f.attachEvent) { f.attachEvent("onload", resize); } else { return; } resize(); } //]]> </script> <iframe src="main.html" name="mainframe" id="mainframe" width="" height="" frameborder="0"></iframe>![]()
That went fast.
example is on colin-roberts.net i use expandable iframes..
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Source always after the name and id Nick :eusa_naug
Code:<script type="text/javascript"> //<![CDATA[ window.onload = function() { var f = document.getElementById("mainframe"); function resize() { var h = ""; var w = ""; if (f.contentDocument) { h = f.contentDocument.documentElement.offsetHeight + 20 + "px"; // can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width"); } else if (f.contentWindow) { h = f.contentWindow.document.body.scrollHeight + 5 + "px"; } else { return; } f.setAttribute("height",h); f.parentNode.setAttribute("height",h); } if (window.addEventListener) { f.onload = resize; } else if (f.attachEvent) { f.attachEvent("onload", resize); } else { return; } resize(); } //]]> </script> <iframe name="mainframe" id="mainframe" src="main.html" width="" height="" frameborder="0"></iframe>
Last edited by alarmclock; 24-12-2006 at 02:54 PM.
Long time since I've done this stuff![]()
That went fast.
Want to hide these adverts? Register an account for free!