|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Vertical Scroller
I have the following iframe-based Vertical Scroller code taken from Dynamic Drive, and modified it a little so it's various variable can be controlled by PHP. The problem is, why does it work sometimes and at other times, it jerks up and down when i refresh the page.
Am using IE6. However, when i tried in iE5, it worked consistently. <? // this file, external.php is sourced in from iframe's(caller) src property $nNoticeID = trim($NoticeID); $nScrollSpeed = 3; $nInitialFromTop = 10; $nRate = 50; ?> <html> <body> <div id="datacontainer<?=$nNoticeID?>" style="position:absolute;left:0;top:10;width:100%" onMouseover="scrollspeed=0" onMous eout="scrollspeed=cache"> <!-- ADD YOUR SCROLLER COMMENT INSIDE HERE---------------------> <? $sSqlGetNoticeContent = "select noticecontent from noticeboard where noticeid='$nNoticeID'"; $rsSqlGetNoticeContent = &$sConn->Execute($sSqlGetNoticeContent) or die ("Error: ****!!!"); $sNoticeContent = $rsSqlGetNoticeContent->fields('noticecontent'); $rsSqlGetNoticeContent->Close(); $sConn->Close(); echo $sNoticeContent; ?> <!-- END SCROLLER CONTENT----------------------------------------> <div> <script language="JavaScript1.2"> //<iframe> script by Dynamicdrive.com //Specify speed of scroll. Larger=faster (ie: 5) //Adjust scrollspeed and setTimeout timer value to create paused messages var scrollspeed = cache = <?=$nScrollSpeed?> // this determines how large a step to be taken in // scrolling (how much 'ground', measured in pixels to be covered) var divid = <?=$nNoticeID?>; var initialfromtop = <?=$nInitialFromTop?>; var rate = <?=$nRate?>; function initialize(){ // marqueeheight = document.all ? parent.document.all.datamain.height : parent.document.getElementById("datamain").getAt tribute("height") // dataobj = document.all ? eval('document.all.datacontainer' + divid) : eval('document.getElementById("datacontainer' + divid + '")') dataobj = eval('document.all.datacontainer' + divid) // dataobj = document.all.datacontainer1 dataobj.style.top = initialfromtop // set to original position thelength = dataobj.offsetHeight // offsetHeight to get the total length of message scrolltest() } function scrolltest(){ dataobj.style.top = parseInt(dataobj.style.top) - scrollspeed if (parseInt(dataobj.style.top) < thelength * (-1)) dataobj.style.top = initialfromtop // resets scroller to its original position, higher the number, further away // the message scroller is from top of IFRAME setTimeout("scrolltest()", rate) // second argument determines how long you want to pause the message // before scrolling off again } window.onload=initialize </script> </body> </html> Sorry for being messy, but can anyone help? Thank you
__________________
Beginner |
|
#2
|
|||
|
|||
|
is there an online version we could have a look at?
thanks.... |
|
#3
|
|||
|
|||
|
which one do you mean? if it's the copy of code i have just posted, no. It's somewhere in www.dynamicdrive.com but i have lost the link to it.
|
|
#4
|
|||
|
|||
|
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Vertical Scroller |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|