Quick help on script

J

JC

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>
 
R

Ruso

JC said:
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.
 
F

Fred

Ruso said:
<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 >
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top