Quick help on script

Discussion in 'Javascript' started by JC, Nov 10, 2006.

  1. JC

    JC Guest

    How can I modify this script, so that it opens in a new window ?

    <FORM>
    <INPUT TYPE="BUTTON" VALUE="Download Application"
    ONCLICK="window.location.href='Employment_Application.pdf'">
    </FORM>
    JC, Nov 10, 2006
    #1
    1. Advertising

  2. JC

    Ruso Guest

    JC wrote:
    > How can I modify this script, so that it opens in a new window ?
    >
    > <FORM>
    > <INPUT TYPE="BUTTON" VALUE="Download Application"
    > ONCLICK="window.location.href='Employment_Application.pdf'">
    > </FORM>


    <FORM>
    <INPUT TYPE="BUTTON" VALUE="Download Application"
    ONCLICK="window.open('Employment_Application.pdf')">
    </FORM>

    Enjoy.
    Ruso, Nov 10, 2006
    #2
    1. Advertising

  3. JC

    Fred Guest

    Ruso wrote:
    > JC wrote:
    > > How can I modify this script, so that it opens in a new window ?
    > >
    > > <FORM>
    > > <INPUT TYPE="BUTTON" VALUE="Download Application"
    > > ONCLICK="window.location.href='Employment_Application.pdf'">
    > > </FORM>

    >
    > <FORM>
    > <INPUT TYPE="BUTTON" VALUE="Download Application"
    > ONCLICK="window.open('Employment_Application.pdf')">
    > </FORM>


    Which makes the linked file inaccessible to browsers without script
    support, that don't understand what to do with a PDF file, or that
    over-zealously block popups.

    Use a link for links, that's what they're for. Tell users that the
    file is a PDF, they can then decide for themselves what to do with it
    or rely on their browser's settings to decide for them.

    If the OP *really* wants to use a popup, then use:

    <a href="doc.pdf" onclick="return openPopup(this.href);">...</a>

    Where openPopup() returns true or false depeding on the success of the
    function. How to write a openPopup() is explained reasonably well
    here:

    <URL: http://developer.mozilla.org/en/docs/DOM:window.open >

    --
    Fred
    Fred, Nov 10, 2006
    #3
    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. jack
    Replies:
    1
    Views:
    887
  2. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    Quick Starts - <script> vs code behind

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jan 30, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    362
    HongQuan Wu[MSFT]
    Feb 2, 2006
  3. JKop
    Replies:
    11
    Views:
    852
  4. Jose  Reckoner
    Replies:
    1
    Views:
    534
  5. Jürgen Exner

    Re: Quick perl script-regex question

    Jürgen Exner, Nov 4, 2011, in forum: Perl
    Replies:
    0
    Views:
    1,953
    Jürgen Exner
    Nov 4, 2011
Loading...

Share This Page