-
<html>
<head>
<title>java22</title>
<script language = "JavaScript">
//ブラウザの頭文字("N"=ネットスケープ)
nav=navigator.appName.substring(0,1);
tp=10;ud=screen.height-260; //上下限
lh=10;rh=screen.width-130; //左右端
xx=200;yy=200; //スタート座標
x=10;y=10; //進行方向
function mv(){
setTimeout("mv()",100); //1/10秒繰り返し
//端に来たら進行方向(+−)切り替え//
if(xx>rh){x=-10;} if(xx<lh){x=10;}
if(yy>ud){y=-10;} if(yy<tp ){y=10;}
xx=xx+x;yy=yy+y;
if (nav=="N")
document.layers["xy"].moveTo(xx,yy);
}else{
document.all["xy"].style.top= yy;
document.all["xy"].style.left = xx ;
}
}
</script>
</head>
<body onLoad="mv()">
<script language = "JavaScript">
if (nav=="N")
document.write("<layer name='xy'>");
document.write("<img name='bool'
src='cuts.gif'>");
document.write("</layer>");
}else{
document.write("<div
id='xy' style='position:absolute'>");
document.write("<img name='bool'
src='cuts.gif'>");
document.write("</div>");
}
</script>
</body>
</html>
|
-
<html>
<head>
<title>java22</title>
<script language = "JavaScript">
nav=navigator.appName.substring(0,1);
tp=10;ud=screen.height-260;
lh=10;rh=screen.width-130;
xx=200;yy=200;
x=10;y=10;
function mv(){
setTimeout("mv()",100);
if(xx>rh){x=-10;} if(xx<lh){x=10;}
if(yy>ud){y=-10;} if(yy<tp ){y=10;}
xx=xx+x;yy=yy+y;
if (document.layers){
document.layers["xy"].moveTo(xx,yy);
}else{
document.getElementById("xy").style.top=yy;
document.getElementById("xy").style.left=xx;
}
}
</script>
</head>
<body onLoad="mv()">
<script language = "JavaScript">
if (document.layers){
document.write("<layer name='xy'>");
document.write("<img name='bool'
src='cuts.gif'>");
document.write("</layer>");
}else{
document.write("<div
id='xy' style='position:absolute'>");
document.write("<img name='bool'
src='cuts.gif'>");
document.write("</div>");
}
</script>
</body>
</html>
|