Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setInterval instead of setTimeout

Status
Not open for further replies.

itsita001

Programmer
Nov 6, 2002
21
0
0
IL
How would i use setInterval instead of the setTimeout in this code, so it would have the same effect?

<html>
<body>

<div id=&quot;datacontainer&quot; style=&quot;position:absolute;left:0;top:10;width:100%&quot; onMouseover=&quot;scrollspeed=0&quot; onMouseout=&quot;scrollspeed=cache&quot;>


<b>What's Hot</b></p>
<p align=&quot;left&quot;><strong><font face=&quot;Verdana&quot;><small><a href=&quot; target=&quot;_top&quot;>Source
code encrypter</a>&nbsp;</small></font></strong><br>
<font face=&quot;Verdana&quot; size=&quot;2&quot;>Scramble the source of any chunk of code using
this unique script.</font></p>
<p align=&quot;left&quot;><strong><font face=&quot;Verdana&quot;><small><a href=&quot; target=&quot;_top&quot;>Flashing
links</a>&nbsp;</small></font></strong><br>
<font face=&quot;Verdana&quot;><small>Bring attention to special links, by making them
flash!</small></font></p>
<p align=&quot;left&quot;><small><strong><font face=&quot;Verdana&quot;><a href=&quot; target=&quot;_top&quot;>Roaming
Cursor</a>&nbsp;</font></strong></small><br>
<small><font face=&quot;Verdana&quot;>Display a second, &quot;roaming&quot; cursor on your
page with this fun animation script.</font></small></p>
<p align=&quot;left&quot;><font face=&quot;Verdana&quot;><strong><a href=&quot; target=&quot;_top&quot;><small>Animated
Document title</small></a><br>
</strong><small>Animate into view your document's title!</small></font>


<div>

<script language=&quot;JavaScript1.2&quot;>

var scrollspeed=cache=2

function initialize(){
marqueeheight=document.all? parent.document.all.datamain.height : parent.document.getElementById(&quot;datamain&quot;).getAttribute(&quot;height&quot;)
dataobj=document.all? document.all.datacontainer : document.getElementById(&quot;datacontainer&quot;)
dataobj.style.top=150
thelength=dataobj.offsetHeight
scrolltest()
}

function scrolltest(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed
if (parseInt(dataobj.style.top)<thelength*-1)
dataobj.style.top=150
setTimeout(&quot;scrolltest()&quot;,50)
}

window.onload=initialize

</script>

</body>
</html>
 
function initialize(){
marqueeheight=document.all? parent.document.all.datamain.height : parent.document.getElementById(&quot;datamain&quot;).getAttribute(&quot;height&quot;)
dataobj=document.all? document.all.datacontainer : document.getElementById(&quot;datacontainer&quot;)
dataobj.style.top=150
thelength=dataobj.offsetHeight
window.setInterval(&quot;scrolltest();&quot;,50);
}

function scrolltest(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed
if (parseInt(dataobj.style.top)<thelength*-1)
dataobj.style.top=150
//setTimeout(&quot;scrolltest()&quot;,50)
}
=========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top