-1

It's possible make a link open in a new window (not tab) with this:

<a href="print.html"  onclick="window.open('print.html', 'newwindow', 'width=300, height=250'); return false;"> Print</a>

Is it possible to modify this slightly so that the JavaScript looks at the href of the link so you don't have to write it out twice in the code?

Scimonster
  • 32,893
  • 9
  • 77
  • 89
Evanss
  • 23,390
  • 94
  • 282
  • 505

1 Answers1

1
<a href="print.html"  onclick="window.open(this.href, 'newwindow', 'width=300, height=250'); return false;"> Print</a>

this.href is a reference to the href attribute of the element when in the onclick handler.

Scimonster
  • 32,893
  • 9
  • 77
  • 89