469,292 Members | 1,326 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,292 developers. It's quick & easy.

Quick help on script

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_Applicat ion.pdf'">
</FORM>

Nov 10 '06 #1
2 1004

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_Applicat ion.pdf'">
</FORM>
<FORM>
<INPUT TYPE="BUTTON" VALUE="Download Application"
ONCLICK="window.open('Employment_Application.pdf') ">
</FORM>

Enjoy.

Nov 10 '06 #2
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_Applicat ion.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

Nov 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.