A
aler45dcom
I write a flying text script,but it sinks at the bottom and it stays
there forever.
How to change it so that it flies in the webpage?
<html>
<head>
<title>Flying text</title>
<script type="text/javascript">
<!--
var dom, finalx=700, finaly=540;
function initText() {
dom=document.getElementById("theText").style;
var x=dom.left;
var y=dom.top;
x=x.match(/\d+/);
y=y.match(/\d+/);
moveText(x,y);
}
function moveText(x,y) {
if(x!=finalx)
if (x>finalx) x--;
else x++;
if(y!=finaly)
if (y>finaly) y--;
else y++;
if( (x!=finalx) || (y!=finaly)) {
dom.left=x+"px";
dom.top=y+"px";
}
setTimeout("moveText(" + x + "," + y + ")", 1);
}
//-->
</script>
</head>
<body onload="initText()" >
<p>
<span id="theText" style="position: absolute; left: 100px; top:
100px; font: bold 20pt 'Times Roman'; color: blue;">
Hello!
</span>
</p>
</body>
</html>
there forever.
How to change it so that it flies in the webpage?
<html>
<head>
<title>Flying text</title>
<script type="text/javascript">
<!--
var dom, finalx=700, finaly=540;
function initText() {
dom=document.getElementById("theText").style;
var x=dom.left;
var y=dom.top;
x=x.match(/\d+/);
y=y.match(/\d+/);
moveText(x,y);
}
function moveText(x,y) {
if(x!=finalx)
if (x>finalx) x--;
else x++;
if(y!=finaly)
if (y>finaly) y--;
else y++;
if( (x!=finalx) || (y!=finaly)) {
dom.left=x+"px";
dom.top=y+"px";
}
setTimeout("moveText(" + x + "," + y + ")", 1);
}
//-->
</script>
</head>
<body onload="initText()" >
<p>
<span id="theText" style="position: absolute; left: 100px; top:
100px; font: bold 20pt 'Times Roman'; color: blue;">
Hello!
</span>
</p>
</body>
</html>