PDA

View Full Version : Problem with IFRAME scroller JS



M rosi
09-05-2010, 06:09 AM
Hello,
i'm trying to post news on my site. so i modified this http://www.dynamicdrive.com/dynamicindex2/iframe-scroller.htm

this is the modified page http://www.shmtestforums.uphero.com/IFRAME_scroller/test.html

but i couldn't get, exactly what i want. i really want is

when load the page it should shows only 3 rows


then after few seconds(say 2 seconds), the 1st row should disappear and bellow 3 rows should come up
(eg. when dynamicdrive_1 row is disappear, dynamicdrive_2 & dynamicdrive_3 & dynamicdrive_4 rows should come up)


this rotation should be continuous



i tried this many. but no positive result.
please help me.

this is the problematic java script

<script type="text/javascript">

var scrollspeed=cache=1
var initialdelay=500

function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top="5px"
setTimeout("getdataheight()", initialdelay)
}

function getdataheight(){
thelength=dataobj.offsetHeight
if (thelength==0)
setTimeout("getdataheight()",10)
else
scrollDiv()
}

function scrollDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top="5px"
setTimeout("scrollDiv()",40)
}

if (window.addEventListener)
window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent)
window.attachEvent("onload", initializeScroller)
else
window.onload=initializeScroller

</script>