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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Image not displaying in some browsers

    I have the following code to display an image (and link if there is one):

    Code:
    	if (ads[adNumber].href) 
    	{
    	tempCode += ('<a href="'+ ads[adNumber].href +'" target=_blank "> \n')
    	tempCode += ('<img src="' + ads[adNumber].src + '" width=' + ads[adNumber].width)
    	tempCode += (' onLoad="setTimeout(\'newAd();\',' + refreshTime + ');"')
    	tempCode += ('\n height=' + ads[adNumber].height + ' border=0 >')
    	tempCode += ('</a>')
    	}
    	else
    	{
    	tempCode += ('<img src="' + ads[adNumber].src + '" width=' + ads[adNumber].width)
    	tempCode += (' onLoad="setTimeout(\'newAd();\',' + refreshTime + ');"')
    	tempCode += ('\n height=' + ads[adNumber].height + ' border=0 >')
    	}
    	return tempCode;
    This works OK in IE9 but only shows the image if there is no link in IE7 (that is, if (ads[adNumber].href) is not true).

    Thanks for any help!

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Location
    Sweden
    Posts
    154
    Thanks
    1
    Thanked 22 Times in 22 Posts
    Try adding a double-quote (and removing a space) so that target=_blank " becomes target="_blank"

  • Users who have thanked ironboy for this post:

    eacollie (10-06-2011)

  • #3
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you! Thank you! That worked beautifully!


  •  

    Posting Permissions

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