Reputation: 71
I have a hyperlink that is:
<a href="some.html">Test</a>
If I click on the Test link, some.html
should open as pop up menu with some given width & height.
How can I do this?
Upvotes: 6
Views: 89035
Reputation: 31
Try use this code :
<a href="javascript: void(0)" onclick="window.open('yourLink','_blank','width=900,height=300');">Try</a>
Using javascript: void(0)
to make no any contact of previous page after you click popup window.
Upvotes: 1
Reputation: 12349
easy way to implement without the anchor element and without the new popup window toolbar
<span class="popup" onClick="javascript:window.open('http://www.google.com', '_blank','toolbar=no,width=250,height=250');">
Upvotes: 1
Reputation: 4221
Using target='_blank'
sometimes opens in a new tab, and it usually does for Firefox and Chrome. Your best best is to use Frédéric's code:
<a href="javascript:window.open('some.html', 'yourWindowName', 'width=200,height=150');">Test</a>
Upvotes: 6
Reputation: 263077
You can use window.open():
<a href="javascript:window.open('some.html', 'yourWindowName', 'width=200,height=150');">Test</a>
Or:
<a href="#" onclick="window.open('some.html', 'yourWindowName', 'width=200,height=150');">Test</a>
Upvotes: 12
Reputation: 382841
To open in popup, you can use target="_blank"
:
<a href="some.html" target="_blank">Test</a>
Or use window.open
:
<a href="#" onclick="window.open('some.html', 'win', 'width=400,height="400"')">Test</a>
Upvotes: 3