JavaScript練習題目(4)彈出新視窗,並點選其上的按鈕可以進行(50px,50px)的位移...

鍾超發表於2011-11-17
<html>
	<head>
		<title>Web Title</title>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
		<script type="text/javascript" src="js/test.js"></script>
	</head>
	<body>
		<input type="button" value="Click" onclick="test();" />
	</body>
</html>


function test () {
	newWindow = window.open('', '', 'width=200, height=100');
	newWindow.document.write("<html><head></head><body>");
	newWindow.document.write("<input type='button' value='move' onclick='move();' />");
	newWindow.document.write("<script type='text/javascript' src='js/test.js'></script>");
	newWindow.document.write("</body></html>");
}
function move () {
	self.moveBy(50, 50);
	self.focus();
}


相關文章