View Full Version : Javascript (Iframe)
Hi
Im trying to use an iframe, I dont really like them, but in this situation i really need to use them. Im trying to make them so that the user wont realise its there, One thing that gives it away is when it loads it shows a white background so it gives it away.
Is there anyway to make it so that the user wont realise its there, i believe that GMAIL uses frames.
I was thinking of using Javascript but im not sure, I use the transparency but it still shows the white bg
this is what im using
<iframe src="tabpane.html" frameborder="0" allowtransparency="true" scrolling="no" width="281" height="140"></iframe>
If you have any suggestions or a way to get round this please do so.
Thank you :)
jscheuer1
03-24-2005, 07:30 PM
This is a toughie. Anyone else that knows better feel free to jump in. Anyways, I don't think there is a way to do what you want, for slow connections and older browsers that load frames and iframes slowly even on highspeed connections. However, with a modern browser and highspeed connection, you could initially load a blank page with your preferred color background into the iframe. Put this where you want your iframe:
<noscript><iframe src="tabpane.html" frameborder="0" allowtransparency="true" scrolling="no" width="281" height="140"></iframe></noscript><script type="text/javascript"><!--
document.write('<iframe name="switch" id="switch" src="blank.htm" frameborder="0" allowtransparency="true" scrolling="no" width="281" height="140"></iframe>');
if (document.getElementById)
window.onload="document.getElementById('switch').src='tabpane.html'";
else if (document.all)
window.onload="document.switch.src='tabpane.html'";
//-->
</script>
Untested. You might also want to look into setting the initial alpha and -moz- opacities to 0 and onload changing them to 100 and 1 (respectively).
jscheuer1
03-24-2005, 10:41 PM
I tried this out, seems to work. Example (http://home.comcast.net/~jscheuer1/side/opacity.htm) Here is my code:
<html>
<head>
<title>Opacity Test</title>
<style type="text/css"><!--
#switch{FILTER:alpha(opacity=0);-moz-opacity:0.00;}
--></style>
</head>
<body bgcolor="#d0d0d0">
<noscript><iframe frameborder=0 scrolling=no src=leaves.html width=450px height=500px></iframe></noscript>
<script type="text/JavaScript"><!--
document.write('<iframe frameborder=0 scrolling=no id=switch src=leaves.html width=450px height=500px></iframe>')
function show_iframe(){
if (document.all){
document.getElementById('switch').filters[0].opacity=100;
}
else if(document.getElementById){
document.getElementById('switch').style.MozOpacity=1.0;}
return;
}
window.onload=show_iframe
//-->
</script>
</body>
</html>
Hey guys
Thank you both for helping out.
jscheuer1 that was great it worked like a charm, thanks again :D
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.