|
Source
<HTML lang="ja">
<HEAD>
<TITLE>文字列を移動する</TITLE>
<STYLE type=text/css>
.mouse {
position: absolute;
left: 100px;
top: 100px;
font-size: 30px;
}
#LoveMouse{
color: #006400;
}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
var cnt = 4;
var c1 = new Array(100,100);
c1[0] = screen.width - 200;
document.getElementById('LoveMouse').style.left=c1[0];
document.getElementById('LoveMouse').style.top=c1[1];
function Init(){
document.getElementById('LoveMouse').innerHTML="Welcome";
multiLay();
}
function multiLay(){
var TimeID;
c1[0] --;
if (c1[1] >400)cnt = -4;
if (c1[1] <100)cnt = 4;
c1[1] = c1[1] + cnt;
document.getElementById('LoveMouse').style.left=c1[0];
document.getElementById('LoveMouse').style.top=c1[1];
if(c1[0] >= 10) {
TimerID = setTimeout("multiLay()",1);
} else {
clearTimeout(TimeID);
}
}
</SCRIPT>
</head>
<body bgcolor="#eeeedd" text="#000000" onload="Init()">
<div id='LoveMouse' class='mouse'></div>
</body>
</html>
|