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
    Oct 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with window.open

    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()
    }

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Why do you need to write everything in javascript to make html?
    Create a page in html, and open it by window.open()
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

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


  •  

    Posting Permissions

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