老师,我只能打开和关闭窗口,不能移动和调整

来源:4-1 JS-WINDOW

唏哩哗啦v

2018-12-20 20:47:53

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>JS-Window</title>

</head>

<body>

<button onclick="openw()">打开窗口</button>

<button onclick="closew()">关闭窗口</button>

<button onclick="movew()">移动窗口</button>

<button onclick="resizew()">调整窗口</button>

<script>

var w;

function openw(){

w=window.open('http://www.baidu.com','新窗口哟','width=500,height=300');

}

function closew(){

w.close(500,300);

w.focus();

}

function movew(){

w.moveTo(700,600);

w.focus();

}

function resizew(){

w.resizeTo(250,150);

w.focus();

}

</script>

</body>

</html>


写回答

1回答

好帮手慕阿满

2018-12-21

同学你好,在打开窗口时传入网址,调整和移动窗口将会失效,所以同学将打开窗口时传入的网址去掉再试试。

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快!

0

0 学习 · 10204 问题

查看课程