为什么我的这段代码的重置和移动不能用?

来源:4-1 JS-WINDOW

慕村1463237

2019-03-14 15:25:08

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

</head>

<body>

<button onclick="openw()">创建窗口</button>

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

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

<button onclick="resizew()">重置窗口</button>

<script type="text/javascript">

var x;

function openw(){

x=window.open('https://www.baidu.com/','百度','width=200px,height=200px');

}

function closew(){

x.close();  //用.表示操作的x这个窗口

x.focus();

}

function movew(){

x.moveTo(100,200);

x.focus();

}

function resizew(){

x.resizeTo(300,300);

x.focus();

}

</script>

</body>

</html>


写回答

1回答

好帮手慕阿满

2019-03-14

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

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


0

0 学习 · 10204 问题

查看课程