我有一个这样的链接:
<a href="/index2.php?option=com_jumi&fileid=3&Itemid=11" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,')
我希望新的打开窗口以特定大小打开。如何指定高度和宽度?
我有一个这样的链接:
<a href="/index2.php?option=com_jumi&fileid=3&Itemid=11" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,')
我希望新的打开窗口以特定大小打开。如何指定高度和宽度?
<a href="/index2.php?option=com_jumi&fileid=3&Itemid=11"
onclick="window.open(this.href,'targetWindow',
`toolbar=no,
location=no,
status=no,
menubar=no,
scrollbars=yes,
resizable=yes,
width=SomeSize,
height=SomeSize`);
return false;">Popup link</a>
其中宽度和高度是没有单位的像素(宽度=400 不是宽度=400px)。
在大多数浏览器中,如果它不是在没有换行符的情况下编写的,它将无法工作,一旦设置了变量,所有内容都在一行中:
<a href="/index2.php?option=com_jumi&fileid=3&Itemid=11" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=SomeSize,height=SomeSize'); return false;">Popup link</a>
window.open ("http://www.javascript-coder.com",
"mywindow","menubar=1,resizable=1,width=350,height=250");
从
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml
:]
window.open('http://somelocation.com','mywin','width=500,height=500');
只需将它们添加到参数字符串中即可。
window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=350,height=250')
<a style="cursor:pointer"
onclick=" window.open('http://YOUR.URL.TARGET','',' scrollbars=yes,menubar=no,width=500, resizable=yes,toolbar=no,location=no,status=no')">Your text</a>