1.打开新窗口:window.open()
<button onclick="isOpen()">打开百度</button>
<script>
function isOpen(){
myBaidu = window.open('http://www.baidu.com');
}
</script>
2.关闭当前窗口:window.close()
<button onclick="isClose()">关闭当前网页</button>
<script>
function isClose(){
window.close();
}
</script>
3.移动当前窗口:window.moveTo()
<button onclick="isOpen()">打开网页</button>
<button onclick="isMove()">移动网页</button>
<script>
function isOpen(){
myweb = window.open('','','width=400,height=200');
}
function isMove(){
myweb.moveTo(200,200);
}
</script>
4.调整当前窗口的尺寸:window.resizeTo()
<button onclick="isOpen()">打开网页</button>
<button onclick="isResize()">调整网页大小</button>
<script>
function isOpen(){
myweb = window.open('','','width=400,height=200');
}
function isResize(){
myweb.resizeTo(600,600)
}
</script>