javascript - How to open a new window when clicking a hyperlink? -
After clicking on a hyperlink I would like to open a new window with a height of 600px and a width of 200px.
How can I do this in HTML / Javascript?
Do I use something like window. open? Is it also compatible with IE? Or should I use something in the jacquery?
Thanks in advance.
It is far better to engage hyperlinks without any inherently:
< P> HTML & lt; A href = "mypopup.htm" id = "popup" & gt; This will open in a new window & lt; / A & gt;
Javascript
window.onload = function {document.getElementById ("popup"). Onclick = function () {Return! Window. Open (this .hrf, "pop", "width = 200, height = 600"); }}
The advantage of this approach is that you only have to specify the hyperlink in your HTML, and if Javascript is disabled or causes an error for some reason, a standard hyperlink.
Comments
Post a Comment