Images Won't display in IE 7
-
Would someone please tell me why this js won't display images in IE 7, but works perfectly in Firefox? I'm using Windows XP, and I've double-checked all my settings in IE 7. Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Sample</TITLE><SCRIPT LANGUAGE="JavaScript">
window.onload = fnWrite;function fnWrite()
{
// Declare variables
var vTable = document.createElement("TABLE");
var vTBody = document.createElement("TBODY");
var vRow, vCell, vDiv, vImg;
var i;var images = new Array();
images[0] = "images/treble_f1.JPG";
images[1] = "images/treble_c1.JPG";
images[2] = "images/treble_d1.JPG";
images[3] = "images/treble_e1.JPG";// Insert vBody into vTable
vTable.appendChild(vTBody);// Insert a row
vRow = document.createElement("TR");
vTBody.appendChild(vRow);
vCell = document.createElement("TD");
vRow.appendChild(vCell);// Insert images
for (i=0; i<images.length; i++)
{
vDiv = document.createElement("DIV");
vCell.appendChild(vDiv);vImg = document.createElement("IMG"); vImg.src = images\[i\]; vImg.setAttribute("alt", "image"); vCell.appendChild(vImg);
}
// Insert the table
vTableContainer.appendChild(vTable);
}
</SCRIPT></HEAD>
<BODY>
<H1>Javascript Won't Work in IE 7</H1>
<div id="vTableContainer"></div></BODY>
</HTML> -
Would someone please tell me why this js won't display images in IE 7, but works perfectly in Firefox? I'm using Windows XP, and I've double-checked all my settings in IE 7. Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Sample</TITLE><SCRIPT LANGUAGE="JavaScript">
window.onload = fnWrite;function fnWrite()
{
// Declare variables
var vTable = document.createElement("TABLE");
var vTBody = document.createElement("TBODY");
var vRow, vCell, vDiv, vImg;
var i;var images = new Array();
images[0] = "images/treble_f1.JPG";
images[1] = "images/treble_c1.JPG";
images[2] = "images/treble_d1.JPG";
images[3] = "images/treble_e1.JPG";// Insert vBody into vTable
vTable.appendChild(vTBody);// Insert a row
vRow = document.createElement("TR");
vTBody.appendChild(vRow);
vCell = document.createElement("TD");
vRow.appendChild(vCell);// Insert images
for (i=0; i<images.length; i++)
{
vDiv = document.createElement("DIV");
vCell.appendChild(vDiv);vImg = document.createElement("IMG"); vImg.src = images\[i\]; vImg.setAttribute("alt", "image"); vCell.appendChild(vImg);
}
// Insert the table
vTableContainer.appendChild(vTable);
}
</SCRIPT></HEAD>
<BODY>
<H1>Javascript Won't Work in IE 7</H1>
<div id="vTableContainer"></div></BODY>
</HTML>Try moving the line
window.onload = fnWrite;
after the
fnWrite()
function block.Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Try moving the line
window.onload = fnWrite;
after the
fnWrite()
function block.Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
Thanks for the reply, however that did not fix this problem. The IE browser does display the little thumbnail box, which tells me the image tag is there, but this line of code vImg.src = images[i]; for some reason is not setting the source for the image. I've even tried hard coding in the source with no luck.
-
Thanks for the reply, however that did not fix this problem. The IE browser does display the little thumbnail box, which tells me the image tag is there, but this line of code vImg.src = images[i]; for some reason is not setting the source for the image. I've even tried hard coding in the source with no luck.
Sorry, it was a bit of a stab in the dark, but I know that there are some strange inconsistencies between IE and the other browsers.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Sorry, it was a bit of a stab in the dark, but I know that there are some strange inconsistencies between IE and the other browsers.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Thanks for the reply. Well, I removed the javascript from the HTML page and put it in a js file, and now it works. Go figure... Thanks a lot, Microsoft. :(
-
Would someone please tell me why this js won't display images in IE 7, but works perfectly in Firefox? I'm using Windows XP, and I've double-checked all my settings in IE 7. Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Sample</TITLE><SCRIPT LANGUAGE="JavaScript">
window.onload = fnWrite;function fnWrite()
{
// Declare variables
var vTable = document.createElement("TABLE");
var vTBody = document.createElement("TBODY");
var vRow, vCell, vDiv, vImg;
var i;var images = new Array();
images[0] = "images/treble_f1.JPG";
images[1] = "images/treble_c1.JPG";
images[2] = "images/treble_d1.JPG";
images[3] = "images/treble_e1.JPG";// Insert vBody into vTable
vTable.appendChild(vTBody);// Insert a row
vRow = document.createElement("TR");
vTBody.appendChild(vRow);
vCell = document.createElement("TD");
vRow.appendChild(vCell);// Insert images
for (i=0; i<images.length; i++)
{
vDiv = document.createElement("DIV");
vCell.appendChild(vDiv);vImg = document.createElement("IMG"); vImg.src = images\[i\]; vImg.setAttribute("alt", "image"); vCell.appendChild(vImg);
}
// Insert the table
vTableContainer.appendChild(vTable);
}
</SCRIPT></HEAD>
<BODY>
<H1>Javascript Won't Work in IE 7</H1>
<div id="vTableContainer"></div></BODY>
</HTML> -
Would someone please tell me why this js won't display images in IE 7, but works perfectly in Firefox? I'm using Windows XP, and I've double-checked all my settings in IE 7. Thanks!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Sample</TITLE><SCRIPT LANGUAGE="JavaScript">
window.onload = fnWrite;function fnWrite()
{
// Declare variables
var vTable = document.createElement("TABLE");
var vTBody = document.createElement("TBODY");
var vRow, vCell, vDiv, vImg;
var i;var images = new Array();
images[0] = "images/treble_f1.JPG";
images[1] = "images/treble_c1.JPG";
images[2] = "images/treble_d1.JPG";
images[3] = "images/treble_e1.JPG";// Insert vBody into vTable
vTable.appendChild(vTBody);// Insert a row
vRow = document.createElement("TR");
vTBody.appendChild(vRow);
vCell = document.createElement("TD");
vRow.appendChild(vCell);// Insert images
for (i=0; i<images.length; i++)
{
vDiv = document.createElement("DIV");
vCell.appendChild(vDiv);vImg = document.createElement("IMG"); vImg.src = images\[i\]; vImg.setAttribute("alt", "image"); vCell.appendChild(vImg);
}
// Insert the table
vTableContainer.appendChild(vTable);
}
</SCRIPT></HEAD>
<BODY>
<H1>Javascript Won't Work in IE 7</H1>
<div id="vTableContainer"></div></BODY>
</HTML>A massive problem of Microsoft If you want reders animated gifs then that will by chrashed by Internet Explorer preload img with '?' after suffix (:gif?) have no result: animated gif even not rendered. e.g. // X00 is an existing image object // X01 is an existing preloaded image object with filled .src of an animated gif X00.src=X01.src+'?'; // only if IE exists X00.src=X01.src; // for opera etc. preload image var imgObjekt1=new Image(); // height and width if you want imgObjekt1.src='animated.gif'; // maybe with path, but not with '?' vImg = document.createElement("IMG"); // check pionter ! if(vImg!=null) { // append into object (into child of body) // append into collection images automatically // check pointer of appended object, use e.g. var imgAppendedImgObject if(imgAppendedImgObject!=null) {imgAppendedImgObject.src=imgObjekt1.src+'?'; // will be (now) rendered in body in IE } }