Results 1 to 3 of 3

Thread: Firefox compatibility issue

  1. #1
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Firefox compatibility issue

    I know that "USING SAME SCRIPT ON SAME PAGE" issues are not really answered here...but my problem seems to be MORE OF A FIREFOX COMPATIBILITY ISSUE....here's my problem guys, :

    I want to use one same javascript (text up-down scroller) twice on the same page (which is my homepage). So, what i'm doing right now is that i'm calling to functions populate() and populate2() in the body tag of my index file.
    hence my body tag looks like <body onload= populate(); populate2();>
    My two javascripts reside
    in two external .js files, named hindimoviesscript.js and othermoviesscript.js.
    I'm calling the two javascripts at two different locations like this:
    <td><script src="hindimoviescript.js"></script></td>
    <td><script src="othermoviescript.js"></script></td>

    Now the problem is that both the scripts work fine in IE, but in firefox, only the
    first one loads up and not the second one...
    to visualise the problem go to www.bombaybazaarmadison.com in IE and then in firefox...
    i have already changed the name of the variables and other functions in the
    second script...
    here's my first .js file ( hindimoviesscripts.js):
    ****************************************************


    // Scrollers width here (in pixels)
    var scrollerwidth="120px"

    // Scrollers height here
    var scrollerheight="200px"

    // Scrollers speed here (larger is faster 1-10)
    var scrollerspeed=1

    // Scrollers content goes here! Keep all of the message on the same line!

    var scrollercontent='<center><font face="verdana" size="2" color="005680"><b>Benaras<br>Naughty Boy<br>Being Cyrus<br>Malaamal Weekly<br>Umar<br>Taxi No 9211 <br>Banana Brothers<br>Teesri Aankh<br>Madhubala<br>(Mr. 100% The Real Player)<br>Rang De Basanti<br>Holiday<br>Dosti<br>Fight Club<br>Zinda<br></b></font><center>'

    var pauseit=2

    // Change nothing below!

    scrollerspeed=(document.all)? scrollerspeed : Math.max(1, scrollerspeed-1) //slow speed down by 1 for NS
    var copyspeed=scrollerspeed
    var iedom=document.all||document.getElementById
    var actualheight=''
    var cross_scroller, ns_scroller
    var pausespeed=(pauseit==0)? copyspeed: 0

    function populate(){
    if (iedom){
    cross_scroller=document.getElementById? document.getElementById("iescroller") : document.all.iescroller
    cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
    cross_scroller.innerHTML=scrollercontent
    actualheight=cross_scroller.offsetHeight
    }
    else if (document.layers){
    ns_scroller=document.ns_scroller.document.ns_scroller2
    ns_scroller.top=parseInt(scrollerheight)+8
    ns_scroller.document.write(scrollercontent)
    ns_scroller.document.close()
    actualheight=ns_scroller.document.height
    }
    lefttime=setInterval("scrollscroller()",20)
    }


    function scrollscroller(){

    if (iedom){
    if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8))
    cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px"
    else
    cross_scroller.style.top=parseInt(scrollerheight)+8+"px"
    }
    else if (document.layers){
    if (ns_scroller.top>(actualheight*(-1)+8))
    ns_scroller.top-=copyspeed
    else
    ns_scroller.top=parseInt(scrollerheight)+8
    }
    }

    if (iedom||document.layers){
    with (document){
    if (iedom){
    write('<div style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed">')
    write('<div id="iescroller" style="position:absolute;left:0px;top:0px;width:100%;">')
    write('</div></div>')
    }
    else if (document.layers){
    write('<ilayer width='+scrollerwidth+' height='+scrollerheight+' name="ns_scroller">')
    write('<layer name="ns_scroller2" width='+scrollerwidth+' height='+scrollerheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed"></layer>')
    write('</ilayer>')
    }
    }
    }

    ***********************************************************


    Othermoviesscript.js:

    ************************************************

    // Scrollers width here (in pixels)
    var scrollerwidth2="120px"

    // Scrollers height here
    var scrollerheight2="200px"

    // Scrollers speed here (larger is faster 1-10)
    var scrollerspeed2=1

    // Scrollers content goes here! Keep all of the message on the same line!

    var scrollercontent2='<center><font face="verdana" size="2" color="005680"><b><font size="2" color ="#FF9933">Telugu</font><br>---------------<br>Yuvakulu<br>Athadu<br>Ayyinda Leda<br>Ji<br>Mogudspellams<br>Seenugadu<br>Police<br>Ghajini<br>Sarada Saradaga<br>Nayakudu<br>Keedi No1<br>Ghambeera<br>Bommoa Ammo<br>SMS<br>Charrpathi<br>-------------<br><br><font size="2" color="#FF9933">Tamil</font><br>-------------<br>Sukran<br>Thottachinunga<br>Veeran<br>Sevvel<br>-------------<br><br><font size="2" color="#FF9933">Punjabi</font><br>-------------<br>Pind Di Kudi<br>Kesari Nishaan Jhoolde<br>(Siddha Chal Canada Nu)<br>-------------<br><br><font size="2" color="#FF9933">Malyalam</font><br>-------------<br>Koottu<br>Chiuna<br>-------------</b></font><center>'

    var pauseit2=2

    // Change nothing below!

    scrollerspeed2=(document.all)? scrollerspeed2 : Math.max(1, scrollerspeed2-1) //slow speed down by 1 for NS
    var copyspeed2=scrollerspeed2
    var iedom2=document.all||document.getElementById2
    var actualheight2=''
    var cross_scroller2, ns_scroller2
    var pausespeed2=(pauseit2==0)? copyspeed2: 0

    function populate2(){
    if (iedom2){
    cross_scroller2=document.getElementById2? document.getElementById("iescroller") : document.all.iescroller2
    cross_scroller2.style.top=parseInt(scrollerheight2)+8+"px"
    cross_scroller2.innerHTML=scrollercontent2
    actualheight2=cross_scroller2.offsetHeight
    }
    else if (document.layers){
    ns_scroller2=document.ns_scroller2.document.ns_scroller3
    ns_scroller2.top=parseInt(scrollerheight2)+8
    ns_scroller2.document.write(scrollercontent2)
    ns_scroller2.document.close()
    actualheight2=ns_scroller2.document.height
    }
    lefttime2=setInterval("scrollscroller2()",20)
    }


    function scrollscroller2(){

    if (iedom2){
    if (parseInt(cross_scroller2.style.top)>(actualheight2*(-1)+8))
    cross_scroller2.style.top=parseInt(cross_scroller2.style.top)-copyspeed2+"px"
    else
    cross_scroller2.style.top=parseInt(scrollerheight2)+8+"px"
    }
    else if (document.layers){
    if (ns_scroller2.top>(actualheight2*(-1)+8))
    ns_scroller2.top-=copyspeed2
    else
    ns_scroller2.top=parseInt(scrollerheight2)+8
    }
    }

    if (iedom2||document.layers){
    with (document){
    if (iedom2){
    write('<div style="position:relative;width:'+scrollerwidth2+';height:'+scrollerheight2+';overflow:hidden" onMouseover="copyspeed2=pausespeed2" onMouseout="copyspeed2=scrollerspeed2">')
    write('<div id="iescroller2" style="position:absolute;left:0px;top:0px;width:100%;">')
    write('</div></div>')
    }
    else if (document.layers){
    write('<ilayer width='+scrollerwidth2+' height='+scrollerheight2+' name="ns_scroller2">')
    write('<layer name="ns_scroller2" width='+scrollerwidth2+' height='+scrollerheight2+' left=0 top=0 onMouseover="copyspeed2=pausespeed2" onMouseout="copyspeed2=scrollerspeed2"></layer>')
    write('</ilayer>')
    }
    }


    ********************************************************************************

    FYI, this is one of dynamicdrivescripts.....
    once again, it works in IE, but only 1 script works in firefox...

    Please help....

  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 the second script these changes need to be made, there may be other problems I missed:

    Code:
    scrollerspeed2=(document.all)? scrollerspeed2 : Math.max(1, scrollerspeed2-1) //slow speed down by 1 for NS
    var copyspeed2=scrollerspeed2
    var iedom2=document.all||document.getElementById
    var actualheight2=''
    var cross_scroller2, ns_scroller2
    var pausespeed2=(pauseit2==0)? copyspeed2: 0
    
    function populate2(){
    if (iedom2){
    cross_scroller2=document.getElementById? document.getElementById("iescroller2") : document.all.iescroller2
    That's the trouble with doing what you've done. You missed one 2 (red in the above) and added at least two 2's that don't belong. You used:

    Code:
    document.getElementById2
    in at least two places. However, document.getElementById is a method, not a function or a variable, and there is and can only be one of them, accessible to all scripts on all pages at any time it is needed, for browsers that support it.

    There is already a Pausing up-down Scroller on DD that is OO (object oriented) and can therefore be used multiple times on a page. Perhaps if the pauses for it were set to 0, it would function just like what you are trying to do, look into it if you are still having problems.
    - John
    ________________________

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

  3. #3
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    John,

    THANKS, THANKS , THANKS AND SOME MORE THANKS.....

    i cant believe you went through my code with such a keen eye and found
    those TYPOS.... that missing 2 was just a mistake on my part. And me changing the name of the methods once again highlights the fact that i'm a copynpaster . Anyways, i corrected those mistakes and ofcourse it works in firefox tooo.....
    I'll look into that OO script too.....

    once again, thanks for your prompt and precise response....

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
  •