простите если что не так. можно ли разместить два скрипта на одной странице что бы они независимо друг от друга работали? | Код | <script type="text/javascript"> <!-- /* Original Javascript code by dynamic drive. Modified javascript code by SuperCat [URL=http://www.ourscripts.net]http://www.ourscripts.net[/URL] Special thanks to Dilandou for helping me with the PHP and JS mixing. Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com) For full source code, 100's more DHTML scripts, and TOS, visit [URL=http://www.dynamicdrive.com]http://www.dynamicdrive.com[/URL] Credit MUST stay intact */
// Start edit speed and size settings
var marqueewidth="100%" //Specify the marquee's width (in pixels) (keep in mind any cell padding and images you may have in your themes). var marqueeheight="100px" //Specify the marquee's height var scrollinterval=50 // Specify the refresh rate. This affects speed too. Larger is slower. var pauseit=1 //Pause marquee onMousever of text area (0=no. 1=yes)?
// End edit speed and size settings
////NO NEED TO EDIT BELOW THIS LINE////////////
var marqueecontent='<p><?php echo "$mid_content"; ?></p>'; var direction='<?php echo "$direction"; ?>';
if (direction=='up') { // Scroll upwards start var marqueespeed=1 // Specify speed (larger is faster 1-10) This is the amount of pixel movement per refresh. 1 is best for smoothness. 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()",scrollinterval) } window.onload=populate
function scrollmarquee(){ if (iedom){ if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) { 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)+8)) { ns_marquee.top-=copyspeed } else { ns_marquee.top=parseInt(marqueeheight)+8 } } } function scrolldown(){ copyspeed=marqueespeed-3;
} function scrolldoubleup(){ copyspeed=marqueespeed+3;
} var txt=''; if (iedom||document.layers){ with (document){ if (iedom){ txt+='<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">' txt+='<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">' txt+='</div></div>' } else if (document.layers){ txt+='<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">' txt+='<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>' txt+='</ilayer>' } } } } // Scroll upwards end
// Scroll downwards start else { var marqueespeed=-1 // Specify speed (larger is faster 1-10) This is the amount of pixel movement per refresh. 1 is best for smoothness. marqueespeed=(document.all)? marqueespeed : -1 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()",scrollinterval) } window.onload=populate
function scrollmarquee(){ if (iedom){ if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) { 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)+8)) { ns_marquee.top-=copyspeed } else { ns_marquee.top=parseInt(marqueeheight)+8 } } } function scrollup(){ copyspeed=marqueespeed+3;
} function scrolldoubledown(){ copyspeed=marqueespeed-3;
} var txt=''; if (iedom||document.layers){ with (document){ if (iedom){ txt+='<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">' txt+='<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">' txt+='</div></div>' } else if (document.layers){ txt+='<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">' txt+='<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>' txt+='</ilayer>' } } } } // Scroll downwards end
//--> </script>
<?
/* Write Table to Screen */
$content = "<script type=\"text/javascript\">document.write(txt);</script>"; //$content .= "<tr><td align=\"center\" colspan=\"6\"bgcolor=\"$bgcolor2\">[ <a href=\"index.php?name=Forums\">".Форум."</a> ] [ <a href=\"index.php?op=modload&name=Forums&file=search\">".Поиск."</a> ]</center></td></tr>"; ?>
|
если я сделаю простую копию то работает только последний, что нужно поменять в нем для независимой работы такого же скролинга на этой же странице с другими данными входными. Это сообщение отредактировал(а) Lamer George - 15.6.2006, 13:05
|