...

View Full Version : Help with window.open



fidoNZ
10-11-2008, 07:14 AM
Hi,

Some help with my problem would be greatly appreciated.

The code below works fine in IE7 but in Firefox 3 the content of the second div overwrites the content of the first div. How do I correct this? Many thanks in advance.

Fido.

function viewArt(artTitle, artURL, artist)
{
var win=window.open (artURL, '', 'location=no,width=950,height=900,left=0,top=0');

win.document.write("<head>");
win.document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"../styles/styleViewArt.css\" />");
win.document.write("<script type=\"text/javascript\" src=\"loadxml.js\"></script>");
win.document.write("<script type=\"text/javascript\">xmlDoc.load(\"index.xml\");</script>");
win.document.write("<title>" + artTitle + " by " + artist + "</title>");
win.document.write("</head>");

win.document.write("<body>");

win.document.write("<div id=\"top\">");
win.document.write("<h1>" + artTitle + "</h1>");
win.document.write("<h2>by " + artist + "</h2>");
win.document.write("<img id=\"art\" src=\"" + artURL + "\" />");
win.document.write("</div>");

win.document.write("<div id=\"bottom\">");
win.document.write("<script type=\"text/javascript\" src=\"../js/loadThumbs.js\"></script>");
win.document.write("</div>");

win.document.write("</body>");

win.document.write("</html>");
win.document.close()
}

abduraooft
10-11-2008, 07:52 AM
Why do you need to write everything in javascript to make html?
Create a page in html, and open it by window.open()

fidoNZ
10-11-2008, 09:26 AM
Thanks for the tip, I've attempted to do that but I am having trouble pulling the variables passed in the function through to the new html page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum