Skip to main content
August 5, 2007
Answered

Images not showing in IE7

  • August 5, 2007
  • 1 reply
  • 694 views
I am having problems displaying images in Internet Explorer 7 (IE7). This code works when I click on the ‘Server debug’ button in Dreamweaver 8/ Coldfusion MX 7.0.2 using the default web browser IE7, but when I run the program code using ‘Preview in IExplorer 7.0’ the images in the body of the code do not display.

Background: My system was written in Dreamweaver MX 2004 using the Coldfusion MX 6 that came with the product and using the Windows XP default web browser Internet Explorer 6. Earlier this year my system was upgraded to Internet Explorer 7 which, I believe, requires me to use ‘strict’ protocol. To comply and keep my system up to date I bought Dreamweaver 8 and started using the Coldfusion MX 7 that came with the product, then I upgraded to Coldfusion MX 7.0.2. I have just started converting some of my code when I noticed the problem with ‘Server debug’ behaving differently to ‘Preview in IExplorer 7.0’.

I have gone into Coldfusion Administrator / Sandbox Security / Defined Directory Permissions / Secured Files and Directories and created an entry for directory “C:\-” with read, write, execute and delete permission in the hope that it would shed some light on the problem but the problem still exists.

I have created a little program (detailed below) that illustrates my problem. In ‘Server debug’ everything works. There is a repeating background image (Fashion.gif), the ‘aaa’ displays, and underneath that the ‘Ximage’ picture displays with 3 pixel border and with the alt text ‘x’, and underneath that the ‘Yimage’ displays with the 5 pixel border and with the alt text ‘y’. In ‘Preview in IExplorer 7.0’ the repeating background image (Fashion.gif) displays, and the ‘aaa’ displays, and underneath that, within the 3 pixel border, there is a small box with the triangle, square and circle with the alt text ‘x’, and underneath that, within the five pixel border, there is a small box with a red ‘x’ with the alt text ‘y’.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
function SetBackgroundImage() {
document.documentElement.style.backgroundImage = "url(C:/Fashion.gif)";
document.getElementById("Yimage").src = "C:/CFusionMX7/wwwroot/MyAppl/Images/MontageSelectedItems.jpg";
}
</script>
</head>

<body onload="SetBackgroundImage()">
aaa
<br />
<img border="3" id="Ximage" alt="x" src="C:/Fashion.gif" />
<br />
<img border="5" id="Yimage" alt="y" src="" />
</body>
</html>


I have exhausted all avenues of attack on this problem. Can someone please help me!?
    This topic has been closed for replies.
    Correct answer
    I am very grateful for your suggestion, and i am surprised! The following piece of code works. Note that localhost:8500 is because I am working on a standalone PC to develop my system before it gets put onto a server (ergo, no [dot]com server address).

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns=" http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function SetBackgroundImage() {
    document.documentElement.style.backgroundImage
    = "url( http://localhost:8500/MyAppl/Images/Fashion.gif)";
    document.getElementById("Yimage").src = " http://localhost:8500/MyAppl/Images/MontageSelectedItems.jpg";
    }
    </script>
    </head>

    <body onload="SetBackgroundImage()">
    aaa
    <br />
    <img border="3" id="Ximage" alt="x" src=" http://localhost:8500/MyAppl/Images/Fashion.gif" />
    <br />
    <img border="5" id="Yimage" alt="y" src="" />
    </body>
    </html>

    1 reply

    Inspiring
    August 6, 2007
    You could try using a file location defined by the server address rather than a local address? ie use http://someserver.com/image.gif.

    Also not sure if the slashes are the right way around in your current version, but maybe wrong on this.

    Mat Evans
    Correct answer
    August 7, 2007
    I am very grateful for your suggestion, and i am surprised! The following piece of code works. Note that localhost:8500 is because I am working on a standalone PC to develop my system before it gets put onto a server (ergo, no [dot]com server address).

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns=" http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function SetBackgroundImage() {
    document.documentElement.style.backgroundImage
    = "url( http://localhost:8500/MyAppl/Images/Fashion.gif)";
    document.getElementById("Yimage").src = " http://localhost:8500/MyAppl/Images/MontageSelectedItems.jpg";
    }
    </script>
    </head>

    <body onload="SetBackgroundImage()">
    aaa
    <br />
    <img border="3" id="Ximage" alt="x" src=" http://localhost:8500/MyAppl/Images/Fashion.gif" />
    <br />
    <img border="5" id="Yimage" alt="y" src="" />
    </body>
    </html>