window.open

1,打开一个新窗口,并控制其样式

<html>
<head>
<script type="text/javascript">
function open_win()
{
window.open("http://www.w3school.com.cn","_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400")
}
</script>
</head>

<body>
<form>
<input type="button" value="打开窗口" onclick="open_win()">
</form>
</body>

</html>

2,打开一个新的窗口

window.open(url,"_blank");

3,打开一个新窗口,并覆盖上次打开的

window.open(url,'newwindow');

4,在本窗口打开

window.open(url,'_self');

原文地址:https://www.cnblogs.com/wangkongming/p/3205843.html