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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting a scroll on top on a page

Status
Not open for further replies.

sharmarkasch

Technical User
Apr 19, 2003
6
NL
hello how do i put this exactly on top of my page??
you can see it running here;

and it is not quite on top of the frame's page.



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

/*
Pausing updown message scroller-
© Dynamic Drive (For full source code, installation instructions,
Terms Of Use, visit */

//configure the below five variables to change the style of the scroller
var scrollerwidth='150px'
var scrollerheight='105px'
var scrollerbgcolor='transparant'
//set below to '' if you don't wish to use a background image
var scrollerbackground='scrollerback.gif'

//configure the below variable to change the contents of the scroller
var messages=new Array()
messages[0]=&quot;<font face='Times New Roman'><a href='test.htm'>Klik hier voor zomershow uitslagen</a></font>&quot;
messages[1]=&quot;<font face='Times New Roman'><a href=' Juni ZOMERSHOW</a></font>&quot;
messages[2]=&quot;<font face='Times New Roman'><a href=' Groot Succes!!</a></font>&quot;
messages[3]=&quot;<font face='Times New Roman'><a href=' + route planner</a></font>&quot;
messages[4]=&quot;<font face='Times New Roman'><a href='messages[5]=&quot;<font face='Times New Roman'><a href=' Clubkampioenschap 2003</a></font>&quot;
messages[6]=&quot;<font face='Times New Roman'><a href=' dit nieuws vakje leuk?? dan ga ik hem gebruiken</a></font>&quot;

///////Do not edit pass this line///////////////////////

var ie=document.all
var dom=document.getElementById

if (messages.length>2)
i=2
else
i=0

function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top>0&&tlayer.top<=5){
tlayer.top=0
setTimeout(&quot;move1(tlayer)&quot;,1000)
setTimeout(&quot;move2(document.main.document.second)&quot;,1000)
return
}
if (tlayer.top>=tlayer.document.height*-1){
tlayer.top-=5
setTimeout(&quot;move1(tlayer)&quot;,50)
}
else{
tlayer.top=parseInt(scrollerheight)
tlayer.document.write(messages)
tlayer.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}

function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top>0&&tlayer2.top<=5){
tlayer2.top=0
setTimeout(&quot;move2(tlayer2)&quot;,1000)
setTimeout(&quot;move1(document.main.document.first)&quot;,1000)
return
}
if (tlayer2.top>=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout(&quot;move2(tlayer2)&quot;,50)
}
else{
tlayer2.top=parseInt(scrollerheight)
tlayer2.document.write(messages)
tlayer2.document.close()
if (i==messages.length-1)
i=0
else
i++
}
}

function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
tdiv.style.top=0+&quot;px&quot;
setTimeout(&quot;move3(tdiv)&quot;,1000)
setTimeout(&quot;move4(second2_obj)&quot;,1000)
return
}
if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
tdiv.style.top=parseInt(tdiv.style.top)-5+&quot;px&quot;
setTimeout(&quot;move3(tdiv)&quot;,50)
}
else{
tdiv.style.top=parseInt(scrollerheight)
tdiv.innerHTML=messages
if (i==messages.length-1)
i=0
else
i++
}
}

function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
tdiv2.style.top=0+&quot;px&quot;
setTimeout(&quot;move4(tdiv2)&quot;,1000)
setTimeout(&quot;move3(first2_obj)&quot;,1000)
return
}
if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
tdiv2.style.top=parseInt(tdiv2.style.top)-5+&quot;px&quot;
setTimeout(&quot;move4(second2_obj)&quot;,50)
}
else{
tdiv2.style.top=parseInt(scrollerheight)
tdiv2.innerHTML=messages
if (i==messages.length-1)
i=0
else
i++
}
}

function startscroll(){
if (ie||dom){
first2_obj=ie? first2 : document.getElementById(&quot;first2&quot;)
second2_obj=ie? second2 : document.getElementById(&quot;second2&quot;)
move3(first2_obj)
second2_obj.style.top=scrollerheight
second2_obj.style.visibility='visible'
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.top=parseInt(scrollerheight)+5
document.main.document.second.visibility='show'
}
}

window.onload=startscroll

</script>


<ilayer id=&quot;main&quot; width=&{scrollerwidth}; height=&{scrollerheight}; bgColor=&{scrollerbgcolor}; background=&{scrollerbackground}; visibility=hide>
<layer id=&quot;first&quot; left=0 top=1 width=&{scrollerwidth};>
<script language=&quot;JavaScript1.2&quot;>
if (document.layers)
document.write(messages[0])
</script>
</layer>
<layer id=&quot;second&quot; left=0 top=0 width=&{scrollerwidth}; visibility=hide>
<script language=&quot;JavaScript1.2&quot;>
if (document.layers)
document.write(messages[dyndetermine=(messages.length==1)? 0 : 1])
</script>
</layer>
<p>&nbsp;</p>
</ilayer>

<script language=&quot;JavaScript1.2&quot;>
if (ie||dom){
document.writeln('<div id=&quot;main2&quot; style=&quot;position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')&quot;>')
document.writeln('<div style=&quot;position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px&quot;>')
document.writeln('<div id=&quot;first2&quot; style=&quot;position:absolute;width:'+scrollerwidth+';left:0px;top:1px;&quot;>')
document.write(messages[0])
document.writeln('</div>')
document.writeln('<div id=&quot;second2&quot; style=&quot;position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden&quot;>')
document.write(messages[dyndetermine=(messages.length==1)? 0 : 1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')
}
</script>
</body>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top