SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot croman's Avatar
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with 2 Javascripts

    First I would like to say.. I have no clue how to write javascripts

    I downloaded a script for a scrolling message and it works great (up and down scroller)

    Now I want to install another script for a side to side scroller message on the same page

    I did and it works, but it stops the first one (the up and down scroller) from working

    So I removed it..

    My page is www.cmfl.us (that is the original scroller) if you would like to see it

    What do I need to do in order to get both javascripts to work on the same page? or is it just not anything you can do.

    Sorry, I just do not have any experience using javascript
    Last edited by croman; Jun 2, 2003 at 11:26.

  2. #2
    SitePoint Zealot Saj's Avatar
    Join Date
    May 2003
    Location
    USA
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post the scripts, or if their too long, can you create a test page with both of them on it?

  3. #3
    SitePoint Zealot croman's Avatar
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I put them both on the website, one of them will not work, the other one just sits there blank. Or (depending on which one I try), one will work inside the box of the other. Kinda wierd

    Here are the core scripts if they help you..

    Here is the first one, the one you see now on the side that scrolls up and down.

    Code:
    <script language="JavaScript1.2">
    //Specify the marquee's width (in pixels)
    var marqueewidth=125
    //Specify the marquee's height
    var marqueeheight=150
    //Specify the marquee's marquee speed (larger is faster 1-10)
    var marqueespeed=1
    //Pause marquee onMousever (0=no. 1=yes)?
    var pauseit=1
    
    //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">This is where the Scrolling Text goes, I removed it for ease of reading.
    
    ////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=marqueeheight+8
    cross_marquee.innerHTML=marqueecontent
    actualheight=cross_marquee.offsetHeight
    }
    else if (document.layers){
    ns_marquee=document.ns_marquee.document.ns_marquee2
    ns_marquee.top=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)+8))
    cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed
    else
    cross_marquee.style.top=marqueeheight+8
    }
    else if (document.layers){
    if (ns_marquee.top>(actualheight*(-1)+8))
    ns_marquee.top-=copyspeed
    else
    ns_marquee.top=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:0;top:0;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>

    This is the code for the Second one that I would put at the top of the screen. But if I do, it does work.. however the other one that I normally have on the side stops working. Just does not do anything, nothing ever scrolls up

    Code:
    <table width="350" border="0" align="center">
            <tr bgcolor="#63639C"> 
              <td>&nbsp; <script language="JavaScript1.2">
    
    /*
    Scrolling Text script- 
    Distributed by http://www.hypergurl.com
    */
    
    
    //Change script's width (in pixels)
    var marqueewidth=300
    //Change script's height (in pixels, pertains only to NS)
    var marqueeheight=20
    //Change script's scroll speed (larger is faster)
    var speed=6
    //Change script's contents
    var marqueecontents='<font face="Arial" font color="#FFFFFF"><strong><big>Have fun with this script from <a href="http://www.hypergurl.com">Hypergurl</a> If you find this script useful, please consider linking to us!</big></strong></font><background color="#00080">'
    
    if (document.all)
    document.write('<marquee scrollAmount='+speed+' style="width:'+marqueewidth+'">'+marqueecontents+'</marquee>')
    
    function regenerate(){
    window.location.reload()
    }
    function regenerate2(){
    if (document.layers){
    setTimeout("window.onresize=regenerate",450)
    intializemarquee()
    }
    }
    
    function intializemarquee(){
    document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>')
    document.cmarquee01.document.cmarquee02.document.close()
    thelength=document.cmarquee01.document.cmarquee02.document.width
    scrollit()
    }
    
    function scrollit(){
    if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){
    document.cmarquee01.document.cmarquee02.left-=speed
    setTimeout("scrollit()",100)
    }
    else{
    document.cmarquee01.document.cmarquee02.left=marqueewidth
    scrollit()
    }
    }
    
    window.onload=regenerate2
    </script></td>
            </tr>
          </table>
    <ilayer width=&{marqueewidth}; height=&{marqueeheight}; name="cmarquee01">
    <layer name="cmarquee02"></layer>
    </ilayer>


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
  •