Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
142
rated 0 times [  149] [ 7]  / answers: 1 / hits: 172373  / 11 Years ago, fri, october 25, 2013, 12:00:00

Code is as following:



    <p class=downloadBoks onclick=location.href='Prosjektplan.pdf'>Prosjektbeskrivelse</p>


Works fine like this, but it opens the file in the same window. I want to apply the target=_blank. But after some googleing I still can't figure it out.


More From » html

 Answers
8

Instead use window.open():



The syntax is:



window.open(strUrl, strWindowName[, strWindowFeatures]);


Your code should have:



window.open('Prosjektplan.pdf');


Your code should be:



<p class=downloadBoks
onclick=window.open('Prosjektplan.pdf')>Prosjektbeskrivelse</p>

[#74731] Thursday, October 24, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
josuea

Total Points: 609
Total Questions: 121
Total Answers: 104

Location: South Georgia
Member since Fri, Nov 13, 2020
4 Years ago
josuea questions
;