-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
  • 31,931
  • 8
  • 74
  • 86
Evanss
  • 20,529
  • 79
  • 252
  • 460

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
  • 31,931
  • 8
  • 74
  • 86