srhino Posted February 18, 2009 Share Posted February 18, 2009 I have found this javascript script I want to use...I want to have php update the content Can someone tell me where to put the PHP code? The Javascript creates a scrolling marquee that scrolls from the bottom of the page to the top...I want to replace the marqueecontent with information from my database Here Is the Javascript <table width="100%"> <tr><td width="15%"> NAV BAR </td> <td> <script language="JavaScript1.2"> //Specify the marquee's width (in pixels) var marqueewidth="800px" //Specify the marquee's height var marqueeheight="400px" //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='<font face="Verdana"> <table border="1" width="100%"><tr><td width="10%">RANK</td><td width="50%">PLAYERS</td><td width="20%">TODAY\'S SCORES</td><td width="10%">THRU</td><td width="10%">TOTAL</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr><tr><td>1</td><td>Scott Rheinhold</td><td> -1</td> <td>18</td><td>-4</td></tr></font>' ////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>') } } } </script> </td></tr></table> Thanks Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/ Share on other sites More sharing options...
Cal Posted February 18, 2009 Share Posted February 18, 2009 Inside the variable "marqueecontent" var marqueecontent='<?php blah blah';?>' Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/#findComment-765165 Share on other sites More sharing options...
srhino Posted February 18, 2009 Author Share Posted February 18, 2009 I tried that but I got an error Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/#findComment-765171 Share on other sites More sharing options...
Cal Posted February 18, 2009 Share Posted February 18, 2009 Show the error. Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/#findComment-765172 Share on other sites More sharing options...
srhino Posted February 18, 2009 Author Share Posted February 18, 2009 the first time I did it nothing showed up...So I assumed I had to put the backslashes where ever the single quotes were...After that I got parse error saying the \ was wrong Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/#findComment-765173 Share on other sites More sharing options...
Cal Posted February 18, 2009 Share Posted February 18, 2009 ? Post the script your currently working with. Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/#findComment-765175 Share on other sites More sharing options...
srhino Posted February 18, 2009 Author Share Posted February 18, 2009 Here it is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <table width="100%"> <tr><td colspan="2" height="90" bgcolor="#008B2B"><img src="header.png" /></td></tr> <tr><td width="15%"> NAV BAR </td> <td> <script language="JavaScript1.2"> /* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com) For full source code, 100's more DHTML scripts, and TOS, visit http://www.dynamicdrive.com Credit MUST stay intact */ //Specify the marquee's width (in pixels) var marqueewidth="800px" //Specify the marquee's height var marqueeheight="400px" //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("myserver.net", "*****", "****") or die(\'Could not connect to database\'); mysql_select_db("bestball", $con) or die(\'Sorry could not connect to the database\'); $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; echo "<br><br><table class=\"table1\" border=\"1\" cellspacing=\"3\" cellpadding=\"3\" width =\"100%\">\n"; echo "<tr><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">RANK</font></td><td class=\"td1\"align=\"center\"><font color=\"#ffffff\">TEAM</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">PLAYER 1</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">PLAYER 2</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">PLAYER 3</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">PLAYER 4</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">CELEB SCORE</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">R1</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">R2</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">R3</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">R4</font></td><td class=\"td1\" align=\"center\"><fant color=\"#ffffff\">SCORE</font></td><td class=\"td1\" align=\"center\"><font color=\"#ffffff\">THRU</font></td> </tr>\n"; 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 " <tr> <td bgcolor=\"#000000\" align=\"center\"><font color=\"#ffffff\">".$rank."</font></td> <td><font color=\"#ffffff\">".$team."</font></td> <td><font color=\"#ffffff\">".$p1."</font></td> <td><font color=\"#ffffff\">".$p2."</font></td><td><font color=\"#ffffff\">".$p3."</font></td> <td><font color=\"#ffffff\">".$p4."</font></td> <td><font color=\"#ffffff\">".$score."</font></td> <td><font color=\"#ffffff\">".$rd1."</font></td> <td><font color=\"#ffffff\">".$rd2."</font></td> <td><font color=\"#ffffff\">".$rd3."</font></td> <td><font color=\"#ffffff\">".$rd4."</font></td><td><font color=\"#ffffff\">".$ttl."</font></td><td><font color=\"#ffffff\">".$th."</font></td></tr>\n"; $recordCounter++; $previousToPar = $ttl; }echo "</table>\n";?>' ////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>') } } } </script> </td></tr></table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/#findComment-765179 Share on other sites More sharing options...
srhino Posted February 19, 2009 Author Share Posted February 19, 2009 ok Link to comment https://forums.phpfreaks.com/topic/145739-solved-please-help-with-script/#findComment-766639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.