View Full Version : Javascript (Iframe)

03-24-2005, 06:47 PM

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 :)

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)
else if (document.all)

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).

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:

<title>Opacity Test</title>

<style type="text/css"><!--
<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){
else if(document.getElementById){

03-26-2005, 01:42 AM
Hey guys
Thank you both for helping out.

jscheuer1 that was great it worked like a charm, thanks again :D