...

View Full Version : Load image on delay works just in FF



acca
07-07-2011, 02:15 PM
I used DrDOS's solution from http://www.codingforums.com/showpost.php?p=994517&postcount=8

and modyfied it a bit so I have 2 images, first without and 2nd with a link to other page.

It works just fine in FF but in Chrome and in IE it shows just 2nd image. On place where first image shall be it's just blank white space. I have javascript enabled in all browsers, btw.

Here's a code in head:


<script type="text/javascript">

function loadImg()

{

document.getElementById("loadimg").innerHTML="<img src=\"logo2.png\"";

}


function loadImg2()

{

document.getElementById("loadimg2").innerHTML="<a href=\"http://site.com\"><img src=\"logo2.png\"</a>";

}

</script>

And here's body part:


<div class="bottleft">

<div id="loadimg"></div>

<script type="text/javascript">var myimg = setTimeout("loadImg();",5000);</script>

</div>

<div class="bottright">

<div id="loadimg2"></div>

<script type="text/javascript">var myimg = setTimeout("loadImg2();",5000);</script>

</div>


I'm trying to figure out this whole day but just can't see where I am making a mistake? :confused:

devnull69
07-07-2011, 02:28 PM
You forgot the closing HTML bracket > for both img tags in your javascript code

acca
07-07-2011, 02:31 PM
I can't belive how stupid mistake. Although, it's usually like that. :)

Thank you so much!

low tech
07-07-2011, 02:32 PM
Hi


It works just fine in FF but in Chrome and in IE it shows just 2nd image.

not sure but is the second var myimg overwriting the first one?

LT

acca
07-07-2011, 02:34 PM
Hi



not sure but is the second var myimg overwriting the first one?

LT

That's what I was thinking and investigating, but now when I closed that HTML bracket > it works fine.

So, problem solved.

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum