makaveli80 Posted August 29, 2007 Share Posted August 29, 2007 Hello, I am trying to avoid using the <marquee></marquee> tags The given code from a website is Step 1: Insert the below code in the <head> section of your page: <style type="text/css"> #marqueecontainer{ position: relative; width: 200px; /*marquee width */ height: 200px; /*marquee height */ background-color: white; overflow: hidden; border: 3px solid orange; padding: 2px; padding-left: 4px; } </style> <script type="text/javascript"> /*********************************************** * Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds) var marqueespeed=2 //Specify marquee scroll speed (larger is faster 1-10) var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)? ////NO NEED TO EDIT BELOW THIS LINE//////////// var copyspeed=marqueespeed var pausespeed=(pauseit==0)? copyspeed: 0 var actualheight='' function scrollmarquee(){ 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" } function initializemarquee(){ cross_marquee=document.getElementById("vmarquee") cross_marquee.style.top=0 marqueeheight=document.getElementById("marqueecontainer").offsetHeight actualheight=cross_marquee.offsetHeight if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit cross_marquee.style.height=marqueeheight+"px" cross_marquee.style.overflow="scroll" return } setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll) } if (window.addEventListener) window.addEventListener("load", initializemarquee, false) else if (window.attachEvent) window.attachEvent("onload", initializemarquee) else if (document.getElementById) window.onload=initializemarquee </script> The CSS at the top controls the basic look of the marquee. Also refer to the variables inside script for additional config options. Step 2: Then add the below HTML to the <body> where you want the marquee to appear: <div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"> <div id="vmarquee" style="position: absolute; width: 98%;"> <!--YOUR SCROLL CONTENT HERE--> <h4>Your scroller contents</h4> <!--YOUR SCROLL CONTENT HERE--> </div> </div> I want to create two marquees, but if I edit one, the other is changed...how do I get two seperate marquee's to run??? Quote Link to comment https://forums.phpfreaks.com/topic/67257-marquee-help/ Share on other sites More sharing options...
ToonMariner Posted August 29, 2007 Share Posted August 29, 2007 function initializemarquee(){ cross_marquee=document.getElementById("vmarquee") cross_marquee.style.top=0 marqueeheight=document.getElementById("marqueecontainer").offsetHeight those lines (and any other with a hard coded getElementById) need to be ablt to accept different values for the element you want the marquee in. this means you need to pass these element ids to the fucntion and swap the hardcoded id's for variables. Also the settings - you will need to be able to make an array of each setting and pass which key of an array the different marquee elements will need to use.... Quote Link to comment https://forums.phpfreaks.com/topic/67257-marquee-help/#findComment-337406 Share on other sites More sharing options...
makaveli80 Posted August 30, 2007 Author Share Posted August 30, 2007 thanks for the reply, I'm not sure what you mean though. Do I basically duplicate those lines you posted function initializemarquee(){ cross_marquee=document.getElementById("vmarquee") cross_marquee.style.top=0 marqueeheight=document.getElementById("marqueecontainer").offsetHeight and change the variables? to like marquee2? and change the id of the second marquee box from vmarquee to vmarquee2?? Quote Link to comment https://forums.phpfreaks.com/topic/67257-marquee-help/#findComment-337781 Share on other sites More sharing options...
ToonMariner Posted August 30, 2007 Share Posted August 30, 2007 that kind of thing... yes Quote Link to comment https://forums.phpfreaks.com/topic/67257-marquee-help/#findComment-337787 Share on other sites More sharing options...
makaveli80 Posted September 2, 2007 Author Share Posted September 2, 2007 I've been trying to figure it out, but havnig no luck...can someone help me with the code please??? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/67257-marquee-help/#findComment-339968 Share on other sites More sharing options...
mosey Posted September 2, 2007 Share Posted September 2, 2007 What have you done so far that's not working? Quote Link to comment https://forums.phpfreaks.com/topic/67257-marquee-help/#findComment-340026 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.