<!DOCTYPE html>
	<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
	</head>
	<body>
		<div>
			<button onclick="openFn()">新窗口</button>
			<button onclick="moveTo()">开启吧</button>
			<button onclick="moveBy()">启动</button>
		</div>
	

	<script>
		var newWindow=null;
		function openFn(){
			newWindow=window.open('','','width=200,height=200');
		}
		function moveTo(){
			newWindow.moveTo(Math.random()*900,Math.random()*900);
			newWindow.focus();
			setTimeout(moveTo,500);
		}
		
	</script>
</body>
</html>

相关文章: