我正在研究html和jquery。我正在尝试使用html代码打开浏览器的新窗口。我获得了有关DOM窗口打开方法的一些信息,但是该方法总是打开一个新选项卡,但是我想打开一个新的不同窗口。请任何人帮助我,以下是w3schools示例供参考。
function myFunction() {
var w = window.open();
w.document.open();
w.document.write("<h1>Hello World!</h1>");
w.document.close();
}
您可以使用以下代码打开新窗口
<!DOCTYPE html>
<html>
<body>
<p>Click the button to open a new window called "MsgWindow" with some text.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var myWindow = window.open("", "MsgWindow", "width=200,height=100");
myWindow.document.write("<p>This is 'MsgWindow'. I am 200px wide and 100px tall!</p>");
}
</script>
</body>
</html>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句