www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] Popup help

  1. #1
    Join Date
    Sep 2003
    Posts
    5

    resolved [RESOLVED] Popup help

    Hi I have dowloaded a simple popup script which in itself works fine, however because I am opening an image directly and not opening a html file the image location is displayed on top of the popup window.

    Is it posibe to include in the popup script some like <title>My heading</title>?

    HTML Code:
    function popUp(URL) {
    	day = new Date();
    	id = day.getTime();
    	eval("page1" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left = 0,top = 0');");
    }
    Thanks so much as always.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Don't use eval
    Code:
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    window["page1" + id] = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left = 0,top = 0');
    window["page1" + id].onload=function() {setTimeout(function(){window["page1" + id].document.title="My heading";}, 1000 );}; // wait for page to load
    }

  3. #3
    Join Date
    Sep 2003
    Posts
    5

    hi

    Thanks so much for the reply but did you miss anything off or do something wrong as it does not work at all now?

    Also I call it like this;

    <a href="javascriptopUp('123.gif')">File name</a>

    Any ideas?

    Thanks again.

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Changed to allow for IE:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    
    <script type="text/javascript">
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    window["page1" + id] = window.open(URL, id, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left=0,top=0');
    }
    
    function changeHeading() {
    window["page1" + id].document.title="My heading";
    }
    </script>
    
    <style type="text/css">
    * {margin:0;padding:0;}
    </style>
    
    </head>
    <body>
    <div><a href="123.gif" alt="image info" onclick="popUp(this.href); changeHeading(); return false;">ajax</a></div>
    </html>

  5. #5
    Join Date
    Sep 2003
    Posts
    5
    Excellent worked erfectly.

    Thanks so much.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles