srhino Posted January 22, 2010 Share Posted January 22, 2010 Can anyone point me in the right direction for a script that will allow me to have my php information scroll up continously...I have a database of golf scores that I would like to have scroll up from bottom to top automatically...I have one now but it stops scrolling after the first 25 entries. If there is something I can change in the script that would be great. //Specify the marquee's width (in pixels) var marqueewidth="1014px" //Specify the marquee's height var marqueeheight="550px" //Specify the marquee's marquee speed (larger is faster 1-10) var marqueespeed=1 //Pause marquee onMousever (0=no. 1=yes)? var pauseit=0 //Specify the marquee's content //Keep all content on ONE line, and backslash any single quotations (ie: that\'s great): var marqueecontent=' <?php $tournid = $_GET['tourn']; $con = mysql_connect("XXXXXX", "XXXXX", "XXXXX") or die('Could not connect to database'); mysql_select_db("bestball", $con) or die('Sorry could not connect to the dadtabase'); $query = "SELECT *, rd1+rd2+rd3+rd4 AS ToPar FROM scoring WHERE tournid = $tournid order by rd1 + rd2 + rd3 + rd4"; $result = mysql_query($query) or die('Could not find Tournament: ' . mysql_error ()); $rank = 1; $recordCounter = 1; $previousScore = 0; $previousToPar=-99; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $score_array = array(); $score_array[] = $row['ToPar']; $team = $row['team']; for($i=1;$i<=5;$i++){ $p[$i] = $row['p' . $i]; } $th = $row['th']; $p1 = $row['p1']; $p2 = $row['p2']; $p3 = $row['p3']; $p4 = $row['p4']; $p5 = $row['p5']; $score = $row['score']; $course = $row['course']; $rd1 = $row['rd1']; $rd2 = $row['rd2']; $rd3 = $row['rd3']; $rd4 = $row['rd4']; $ttl = $row['ToPar']; if ($previousToPar != $ttl){$rank = $recordCounter;} echo "<table align=\"center\" width=\"1014\" border=\"0\"><tr><td class=\"rank\" align=\"center\" rowspan=\"4\" width=\"200\">$rank</td><td class=\"player\" align=\"center\" width=\"414\">$p1</td><td class=\"score\" align=\"center\" rowspan=\"4\" width=\"200\">$rd1</td><td class=\"thru\" align=\"center\" rowspan=\"4\" width=\"200\">$th</td></tr><tr><td class=\"player\" align=\"center\" width=\"414\">$p2</td></tr><tr><td class=\"player\" align=\"center\" width=\"414\">$p3</td></tr><tr><td class=\"player\" align=\"center\" width=\"414\">$p4</td></tr></table> "; $recordCounter++; $previousToPar = $ttl; } ?>' ////NO NEED TO EDIT BELOW THIS LINE//////////// marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS var copyspeed=marqueespeed var pausespeed=(pauseit==0)? copyspeed: 0 var iedom=document.all||document.getElementById var actualheight='' var cross_marquee, ns_marquee function populate(){ if (iedom){ cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee cross_marquee.style.top=parseInt(marqueeheight)+8+"px" cross_marquee.innerHTML=marqueecontent actualheight=cross_marquee.offsetHeight } else if (document.layers){ ns_marquee=document.ns_marquee.document.ns_marquee2 ns_marquee.top=parseInt(marqueeheight)+8 ns_marquee.document.write(marqueecontent) ns_marquee.document.close() actualheight=ns_marquee.document.height } lefttime=setInterval("scrollmarquee()",20) } window.onload=populate function scrollmarquee(){ if (iedom){ if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+) cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px" else cross_marquee.style.top=parseInt(marqueeheight)+8+"px" } else if (document.layers){ if (ns_marquee.top>(actualheight*(-1)+) ns_marquee.top-=copyspeed else ns_marquee.top=parseInt(marqueeheight)+8 } } if (iedom||document.layers){ with (document){ if (iedom){ write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') write('<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">') write('</div></div>') } else if (document.layers){ write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">') write('<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') write('</ilayer>') Thanks ! Link to comment https://forums.phpfreaks.com/topic/189483-help-with-a-marquee-scroll-up-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.