我做了一个,没写玩,本来想做成像小球在屏幕内弹来弹去的效果,但现在这个样子挺好玩,不想动脑子了,反正剩下的工作不多了,你看看有没有用<html> <script language="javascript"> //var w = window.open("kkk.htm","","width=100,height=100"); var i=1; var a = setInterval("move()",50); function move() { j = parseInt(Math.random()*10); if(j<5)i=-i; m = window.screenLeft+i-3; //3是估计的边框的宽度 document.all.l.value = m; document.all.x.value = i; document.all.i1.value = window.screenLeft;
<script language="javascript">
//var w = window.open("kkk.htm","","width=100,height=100");
var i=1;
var a = setInterval("move()",50);
function move()
{
j = parseInt(Math.random()*10);
if(j<5)i=-i;
m = window.screenLeft+i-3; //3是估计的边框的宽度
document.all.l.value = m;
document.all.x.value = i;
document.all.i1.value = window.screenLeft;
j = parseInt(Math.random()*10);
if(j<5)i=-i;
n = window.screenTop+i-22; //22是估计的标题栏的高度
document.all.t.value = n;
document.all.y.value = i;
document.all.i2.value = window.screenTop;
window.moveTo(m,n);
}
</script>
<body>
<input type="text" id="l" size="15">left
<br>
<input type="text" id="t" size="15">top
<br>
<input type="text" id="x" size="15">x
<br>
<input type="text" id="y" size="15">y
<br>
<input type="text" id="i1" size="15">i
<br>
<input type="text" id="i2" size="15">i
</body></html>
<script>
window.open("kkk.htm","","height=200,width=200,status=no,toolbar=no,menubar=no,location=no")
</script>