PremiumBlend
04-26-2006, 12:42 AM
I've created a script that will create a new window to display an image it's title and description. it also has a close button. Everything displays fine, but in FF the status bar at the bottom shows it incomplete and the cursor is a pointer+hourglass as if its not finished loading. i've had this problem before, and i believe i solved it, but i'm not sure if i have or how. am i forgetting something or is there something wrong with my code?
function showProduct(n) {
var prodTitle, prodDesc;
var prodImgSrc = "img/error.png";
for (i = 0; i < product.length; i++) {
if (n == product[i][0]) {
prodTitle = product[i][1];
prodDesc = product[i][2];
prodImgSrc = product[i][3];
}
}
var tempImg = new Image();
tempImg.src = prodImgSrc;
var info = "height=" + (tempImg.height+135) + ",width=" + (tempImg.width+40) + "";
prodWin = window.open("","",info);
prodWin.document.write('<?xml version = "1.0" encoding="utf-8"?>');
prodWin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
prodWin.document.write(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
prodWin.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
prodWin.document.write('<head><title>Atlantic Prints - ' + prodTitle + '</title>');
prodWin.document.write('<link rel="stylesheet" type="text/css" href="css/pPage.css"/></head>');
prodWin.document.write('<body><div class="productdiv">');
prodWin.document.write('<span id="title">' + prodTitle + '</span><br/>');
prodWin.document.write('<img src="' + prodImgSrc + '" id="prodImg"/><br/>');
prodWin.document.write('<span id="desc">' + prodDesc + '</span>');
prodWin.document.write('</div><input type="button" value="Close Window" onclick="');
prodWin.document.write('javascript:self.close();"/></body></html>');
}
function showProduct(n) {
var prodTitle, prodDesc;
var prodImgSrc = "img/error.png";
for (i = 0; i < product.length; i++) {
if (n == product[i][0]) {
prodTitle = product[i][1];
prodDesc = product[i][2];
prodImgSrc = product[i][3];
}
}
var tempImg = new Image();
tempImg.src = prodImgSrc;
var info = "height=" + (tempImg.height+135) + ",width=" + (tempImg.width+40) + "";
prodWin = window.open("","",info);
prodWin.document.write('<?xml version = "1.0" encoding="utf-8"?>');
prodWin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
prodWin.document.write(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
prodWin.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
prodWin.document.write('<head><title>Atlantic Prints - ' + prodTitle + '</title>');
prodWin.document.write('<link rel="stylesheet" type="text/css" href="css/pPage.css"/></head>');
prodWin.document.write('<body><div class="productdiv">');
prodWin.document.write('<span id="title">' + prodTitle + '</span><br/>');
prodWin.document.write('<img src="' + prodImgSrc + '" id="prodImg"/><br/>');
prodWin.document.write('<span id="desc">' + prodDesc + '</span>');
prodWin.document.write('</div><input type="button" value="Close Window" onclick="');
prodWin.document.write('javascript:self.close();"/></body></html>');
}