PDF popup with close button

Discussion in 'Javascript' started by moose, Sep 27, 2004.

  1. moose

    moose Guest

    OK
    Popup window? No problem
    PDF in popup? No problem

    But what about a couple of Close Window buttons?
    Imagine a "Close Window" button at the top of the popup page.
    Then the PDF which can scroll. And another "Close Window" button
    at the bottom of the page.

    Any suggestions for completing this task?
    moose, Sep 27, 2004
    #1
    1. Advertising

  2. moose

    McKirahan Guest

    "moose" <> wrote in message
    news:...
    > OK
    > Popup window? No problem
    > PDF in popup? No problem
    >
    > But what about a couple of Close Window buttons?
    > Imagine a "Close Window" button at the top of the popup page.
    > Then the PDF which can scroll. And another "Close Window" button
    > at the bottom of the page.
    >
    > Any suggestions for completing this task?


    Will this help you; watch for word-wrap.

    <html>
    <head>
    <title>popupPDF.htm</title>
    <script type="text/javascript">
    function popupPDF() {
    var pdf = "http://www.google.com/";
    var htm = "<html><head><title>popupPDF</title>";
    htm += "</head><body>";
    htm += "<a href='javascript:window.close()'>Close</a>";
    htm += "<iframe src='" + pdf +"'></iframe>";
    htm += "<a href='javascript:window.close()'>Close</a>";
    htm += "</body></html>";
    var win = window.open("","popupPDF","");
    win.document.write(htm);
    win.close;
    }
    </script>
    </head>
    <body>
    <a href="javascript:popupPDF()">Popup PDF</a>
    </body>
    </html>
    McKirahan, Sep 27, 2004
    #2
    1. Advertising

  3. moose

    McKirahan Guest

    "McKirahan" <> wrote in message
    news:5VX5d.33815$He1.945@attbi_s01...
    > "moose" <> wrote in message
    > news:...
    > > OK
    > > Popup window? No problem
    > > PDF in popup? No problem
    > >
    > > But what about a couple of Close Window buttons?
    > > Imagine a "Close Window" button at the top of the popup page.
    > > Then the PDF which can scroll. And another "Close Window" button
    > > at the bottom of the page.
    > >
    > > Any suggestions for completing this task?

    >


    You've asked for a "Close" button not a link:

    <html>
    <head>
    <title>popupPDF.htm</title>
    <script type="text/javascript">
    function popupPDF() {
    var pdf = "http://www.google.com/";
    var htm = "<html><head><title>popupPDF</title>";
    htm += "</head><body><center>";
    htm += "<input type='button' value='Close'
    onclick='window.close()'>";
    htm += "<br><br>";
    htm += "<iframe src='" + pdf +"'></iframe>";
    htm += "<br><br>";
    htm += "<input type='button' value='Close'
    onclick='window.close()'>";
    htm += "</center></body></html>";
    var win = window.open("","popupPDF","");
    win.document.write(htm);
    win.close;
    }
    </script>
    </head>
    <body>
    <a href="javascript:popupPDF()">Popup PDF</a>
    </body>
    </html>
    McKirahan, Sep 27, 2004
    #3
  4. moose

    Grant Wagner Guest

    moose wrote:

    > OK
    > Popup window? No problem
    > PDF in popup? No problem
    >
    > But what about a couple of Close Window buttons?
    > Imagine a "Close Window" button at the top of the popup page.
    > Then the PDF which can scroll. And another "Close Window" button
    > at the bottom of the page.
    >
    > Any suggestions for completing this task?


    <a href="loadpdf.cgi?pdf=somefile.pdf"
    target="_blank"
    onclick="window.open(this.href, this.target,
    '..attributes..');return false;"
    >Open somefile.pdf in a new window (maybe, if you haven't

    disabled that functionality on your browser)</a>

    Then have loadpdf.cgi output (using an ASP example, you could use
    PHP, or Perl, or JSP, or ColdFusion, or any other server-side
    technology for this):

    <html>
    <head>
    <title>Window containing <%= Request.Value('pdf') %></title>
    </head>
    <body>
    <!-- your close buttons and stuff -->
    <layer src="<%= Request.Value('pdf') %>"><iframe src="<%=
    Request.Value('pdf') %>"></iframe></layer>
    <!-- more buttons or whatever -->
    </body>
    </html>

    You probably want some dimensions on the <layer> or <iframe> to make
    it bigger than the default size. But remember, the window may not be
    the size _you_ specify. Many browsers can honor your window.open()
    request but still not provide a window the size, position and with
    the chrome you requested.

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
    Grant Wagner, Sep 27, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil
    Replies:
    6
    Views:
    39,383
    atilio123321
    Sep 2, 2011
  2. Iñaki Baz Castillo
    Replies:
    7
    Views:
    824
    Iñaki Baz Castillo
    Jan 12, 2010
  3. Jens Peter Hansen
    Replies:
    7
    Views:
    502
    Randy Webb
    Jun 19, 2004
  4. andrewkooi
    Replies:
    2
    Views:
    96
    Thomas 'PointedEars' Lahn
    Sep 4, 2004
  5. Replies:
    2
    Views:
    449
Loading...

Share This Page