Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Location
    Serbia
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Load image on delay works just in FF

    I used DrDOS's solution from make an image load after a certain amount of time

    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?

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    You forgot the closing HTML bracket > for both img tags in your javascript code

  • Users who have thanked devnull69 for this post:

    acca (07-07-2011)

  • #3
    New to the CF scene
    Join Date
    Dec 2005
    Location
    Serbia
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I can't belive how stupid mistake. Although, it's usually like that.

    Thank you so much!

  • #4
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    851
    Thanks
    172
    Thanked 93 Times in 93 Posts
    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

  • Users who have thanked low tech for this post:

    acca (07-07-2011)

  • #5
    New to the CF scene
    Join Date
    Dec 2005
    Location
    Serbia
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •