Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-07-2011, 01:15 PM   PM User | #1
acca
New to the CF scene

 
Join Date: Dec 2005
Location: Serbia
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
acca is an unknown quantity at this point
Load image on delay works just in FF

I used DrDOS's solution from http://www.codingforums.com/showpost...17&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:
Code:
<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:
Code:
<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?
acca is offline   Reply With Quote
Old 07-07-2011, 01:28 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
You forgot the closing HTML bracket > for both img tags in your javascript code
devnull69 is offline   Reply With Quote
Users who have thanked devnull69 for this post:
acca (07-07-2011)
Old 07-07-2011, 01:31 PM   PM User | #3
acca
New to the CF scene

 
Join Date: Dec 2005
Location: Serbia
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
acca is an unknown quantity at this point
I can't belive how stupid mistake. Although, it's usually like that.

Thank you so much!
acca is offline   Reply With Quote
Old 07-07-2011, 01:32 PM   PM User | #4
low tech
Regular Coder

 
low tech's Avatar
 
Join Date: Dec 2009
Posts: 740
Thanks: 149
Thanked 67 Times in 67 Posts
low tech is on a distinguished road
Hi

Quote:
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
low tech is offline   Reply With Quote
Users who have thanked low tech for this post:
acca (07-07-2011)
Old 07-07-2011, 01:34 PM   PM User | #5
acca
New to the CF scene

 
Join Date: Dec 2005
Location: Serbia
Posts: 8
Thanks: 2
Thanked 0 Times in 0 Posts
acca is an unknown quantity at this point
Quote:
Originally Posted by low tech View Post
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
acca is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:36 PM.


Advertisement
Log in to turn off these ads.