定义和用法
moveTo() 方法可把窗口的左上角移动到一个指定的坐标。
语法
window.moveTo(x,y)
实例
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>moveTo</title>
<script>
var myWindow;
function openWin(){
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>这是我的窗口</p>");
}
function moveWin(){
myWindow.moveTo(54,100);
myWindow.focus();
}
</script>
</head>
<body>
<input type="button" value="打开窗口" onclick="openWin()"/>
<br><br>
<input type="button" value="移动窗口" onclick="moveWin()"/>
</body>
</html>
运行效果
![](https://i-blog.csdnimg.cn/blog_migrate/49d3b28e0a9b4a8a0706800d3a0f3033.png)