Results 1 to 7 of 7

Thread: Conflicting Scripts amd Spacing Porblems

  1. #1
    Join Date
    Apr 2005
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Conflicting Scripts amd Spacing Porblems

    Script1:
    Cross browser Marquee script
    URL:
    http://www.dynamicdrive.com/dynamicindex2/cmarquee.htm


    Script2:
    Fading scroller
    URL:
    http://www.dynamicdrive.com/dynamici...fadescroll.htm

    Hello everyone

    I'm trying to add both of the above scripts to my site and they seem to be conflicting with each other and I was wondering if anybody knew what to change or if I can change anything to make the scripts run nicely on the same page. The other two problems Im having are with the first script, the cross browser marquee script. I was wondering if it was possible to change the border color to somthing other that white. (Im trying to get it to CC0000) The last problem im having is with the spacing on sript 1. It seems to me that its impossible to have different messages with spaces in between. Everything its supposed to say comes across all at the same time even if I put spaces in between and it doesnt look quite right.

    Any help would be greatly appreciated
    Thanks CDNCommando
    Last edited by CDNCommando; 04-10-2005 at 01:28 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In no particular order. To change the border color of the marquee change this line:
    Code:
    document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
    to:
    Code:
    document.write('<table style="border:2px solid #CC0000;" cellspacing="0" cellpadding="0"><td>')
    To put spaces in the marqueecontent variable, you can use:
    Code:
    &nbsp;
    for each extra space you want. If you want alot of space, that will get messy, so you can use this alternate method (changes from the original demo highlighted red):
    Code:
    var marqueecontent='<nobr><pre><font face="Arial" size="3">Thank you for visiting <a href="http://www.dynamicdrive.com">Dynamic Drive.</a> If you find this script useful, please consider linking to us by <a href="../link.htm">click here.</a> Enjoy your stay!</font></pre></nobr>'
    With these changes, regular spaces will be displayed as spaces.

    Now as to your original question, script conflicts, that is so common we have this for it:
    Note: Questions regarding multiple script usage are not usually replied to due to their time consuming nature. See this thread for more information, and this tutorial for one possible solution.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2005
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I see can the problem now I just cant get it working.

    SCRIPT 1: window.onload=dothis
    SCRIPT 2: window.onload=dothat
    RESOLUTION: <body onload="dothis();dothat()">

    Thats whats going on I think I just need to fix this somehow and is not working for me the entire first script just disappears. The help with the color and spacing looks great thanks for your help!
    Last edited by CDNCommando; 04-10-2005 at 05:20 AM.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    What browser are you using? I tested in FF1.0.2, IE6 and NS7.2 with both scripts on one page and they both work, probably owing to browser peculiarities. Try getting rid of:

    Code:
    window.onload=populate
    and:

    Code:
    else if (document.getElementById)
    window.onload=changecontent
    and adding to your body tag

    <body onload="populate();if ((document.getElementById)&&((!window.addEventListener)&&(!window.attachEvent)))changecontent();">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Apr 2005
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I couldnt find the line i was supped to delete I must be using a modified version or somthing. This is the exact script im using.

    <center>
    <script language="JavaScript1.2">

    /*
    Fading Scroller- By DynamicDrive.com
    For full source code, and usage terms, visit http://www.dynamicdrive.com
    This notice MUST stay intact for use
    */

    var delay=3000 //set delay between message change (in miliseconds)
    var fcontent=new Array()
    begintag='<font face="Arial" size=2>' //set opening tag, such as font declarations
    fcontent[0]="Welcome to the home of the Special Ops Clan"
    fcontent[1]="The conversion to battlefield 2 is near completion!"
    fcontent[2]="Just need to get the info and the top marquee working together"
    fcontent[3]="What kind of music should I put on the site?"
    fcontent[4]="Leave no man behind!!!"

    closetag='</font>'

    var fwidth='100px' //set scroller width
    var fheight='120px' //set scroller height

    var fadescheme=1 //set 0 to fade text color from (white to black), 1 for (black to white)
    var fadelinks=1 //should links inside scroller content also fade like text? 0 for no, 1 for yes.

    ///No need to edit below this line/////////////////

    var hex=(fadescheme==0)? 255 : 0
    var startcolor=(fadescheme==0)? "rgb(255,255,255)" : "rgb(0,0,0)"
    var endcolor=(fadescheme==0)? "rgb(0,0,0)" : "rgb(255,255,255)"

    var ie4=document.all&&!document.getElementById
    var ns4=document.layers
    var DOM2=document.getElementById
    var faderdelay=0
    var index=0

    if (DOM2)
    faderdelay=2000

    //function to change content
    function changecontent(){
    if (index>=fcontent.length)
    index=0
    if (DOM2){
    document.getElementById("fscroller").style.color=startcolor
    document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    linksobj=document.getElementById("fscroller").getElementsByTagName("A")
    if (fadelinks)
    linkcolorchange(linksobj)
    colorfade()
    }
    else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag
    else if (ns4){
    document.fscrollerns.document.fscrollerns_sub.document.write(begintag+fcontent[index]+closetag)
    document.fscrollerns.document.fscrollerns_sub.document.close()
    }

    index++
    setTimeout("changecontent()",delay+faderdelay)
    }

    // colorfade() partially by Marcio Galli for Netscape Communications. ////////////
    // Modified by Dynamicdrive.com

    frame=20;

    function linkcolorchange(obj){
    if (obj.length>0){
    for (i=0;i<obj.length;i++)
    obj[i].style.color="rgb("+hex+","+hex+","+hex+")"
    }
    }

    function colorfade() {
    // 20 frames fading process
    if(frame>0) {
    hex=(fadescheme==0)? hex-12 : hex+12 // increase or decrease color value depd on fadescheme
    document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
    if (fadelinks)
    linkcolorchange(linksobj)

    frame--;
    setTimeout("colorfade()",20);
    }

    else{
    document.getElementById("fscroller").style.color=endcolor;
    frame=20;
    hex=(fadescheme==0)? 255 : 0
    }
    }

    if (ie4||DOM2)
    document.write('<div id="fscroller" style="border:0px solid black;width:'+fwidth+';height:'+fheight+';padding:2px"></div>')

    window.onload=changecontent
    </script>
    </center>

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    With that script, the job is much easier, just get rid of:
    Code:
    window.onload=populate
    from the marquee script and:
    Code:
    window.onload=changecontent
    from the fading scroll script and put this in your body tag:
    HTML Code:
    <body onload="changecontent();populate();">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Apr 2005
    Location
    Toronto
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Everything is perferct now thanks man you have been a huge help

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •