Firefox will not run javascript

Discussion in 'JavaScript' started by Arco, Oct 18, 2005.

  1. #1
    IE shows the following script no problems but Firefox does not. This is a "slide-show, text ticker" type script that will show a series of text messages.

    Any suggestions as to what I should do? Thanks.

    link to page: http://www.erikfriedlander.com

    here is the script:

    <style type="text/css">
    /*<![CDATA[*/
    .s {LEFT: -5000px; POSITION: absolute; topt: -5000px;}
    /*]]>*/
    </style>
    <title>
    NewHomePage
    </title>
    <link title="style1" rel="stylesheet" href="css/style1.css"
    type="text/css" />
    <script type="text/javascript">
    //<![CDATA[
    <!-- Beginning of JavaScript -
    // Slide-show and Text-Ticker all in one- Copyright (c) 2000 Peter Gehrig and Urs Dudli (http://www.24fun.ch/)
    // Permission granted to SimplytheBest.net to feature script in our DHTML script collection http://simplythebest.net/scripts/
    // Edit your messages. You can add as many messages a you like.
    var message = new Array()
    message[0]="MEDIA Page has <em>In Concert<\/em> MP3's"
    message[1]="INFO Page has: Bio, Discography, High Resolution Photos"
    message[2]="BUY CD's ----> <u>PROJECTS<\/u>!"
    message[3]="<u>Click Me<\/u> for Affordable, Quality Healthcare For Artists"
    message[4]="<u>MEDIA page<\/u> has MP3's, Video, Radio Shows & More."
    message[5]="<u>CELLO Page<\/u>--Lessons, Travel Tips, Interviews, and More."
    message[6]="BUY Stuff on <u>PROJECTS<\/u>!"

    // The links of your messages. Be sure that you configure as many links as messages.
    // If you don't want to link a message write '#' instead of an URL.
    var messageurl = new Array()
    messageurl[0]="audio.htm#live"
    messageurl[1]="http://www.erikfriedlander.com/info.htm"
    messageurl[2]="projects.htm"
    messageurl[3]="http://www.dancenyc.org/upload/faq/597_Pdf_woodhullartistsrevised6-22.pdf"
    messageurl[4]="audio.htm"
    messageurl[5]="cello.htm"
    messageurl[6]="projects.htm"
    // The images for your messages.
    var messageimg = new Array()
    messageimg[0]="http://www.erikfriedlander.com/images/x.gif"
    messageimg[1]="http://www.erikfriedlander.com/images/x.gif"
    messageimg[2]="http://www.erikfriedlander.com/images/x.gif"
    messageimg[3]="http://www.erikfriedlander.com/images/x.gif"
    messageimg[4]="http://www.erikfriedlander.com/images/x.gif"
    messageimg[5]="http://www.erikfriedlander.com/images/x.gif"
    messageimg[6]="http://www.erikfriedlander.com/images/x.gif"
    // Alignment for each image in relation to its message-text (right or left)
    var alignimg=new Array()
    alignimg[0]="right"
    alignimg[1]="right"
    alignimg[2]="right"
    // Alignment for message in relation to the margin of the messagebox
    var alignmessage=new Array()
    alignmessage[0]="left"
    alignmessage[1]="left"
    alignmessage[2]="left"
    // target of the message-links (HTML conventions)
    var target_url="_top"

    // The width of your ticker
    var textwidth=320
    // The height of your ticker
    var textheight=100
    // The borderwidth of your ticker
    var borderwidth=0
    // The size of the font (HTML3 conventions)
    var font_size=+4
    // font-face
    var font_face="sans-serif"
    // font-color
    var font_color="white"
    // background-color of the ticker
    var bg_ticker="black"
    // The horizontal position of the messagebox: distance to the left margin of the window
    var x_finalpos=0
    // The vertical position of the messagebox: distance to the top margin of the window
    var y_finalpos=20
    // Number of lamellas.
    var x_slices=20
    // Pause beween the messages (milliseconds)
    var pause=2000
    // Do not change the variables below this line
    var imgpreload=new Array()
    for (i=0;i<=messageimg.length-1;i++) {
    imgpreload=new Image()
    imgpreload.src=messageimg
    }
    var i_loop=0
    var i_message=0
    var width_slice=Math.ceil(textwidth/x_slices)

    var cliptop=0
    var clipbottom=textheight
    var i_clipright=1
    var content=""
    function initiate() {
    content+="<table border="+borderwidth+" cellpadding='5' width="+textwidth+" height="+textheight+">"
    content+="<tr><td bgcolor="+bg_ticker+" align="+alignmessage[i_message]+">"
    content+="<img hspace=5 src="+messageimg[i_message]+" align="+alignimg[i_message]+" border='0'>"
    content+="<a href="+messageurl[i_message]+" target="+target_url+">"
    content+="<font face="+font_face+" size="+font_size+" color="+font_color+">"
    content+=message[i_message]
    content+="<\/font><\/a><\/td><\/tr><\/table>"
    if (document.all) {
    for (i=0;i<=x_slices;i++) {
    var thisinners=eval("s"+i)
    thisinners.innerHTML=content
    var thiss=eval("document.all.s"+i+".style")
    thiss.posLeft=x_finalpos
    thiss.posTop=y_finalpos
    }
    i_message++
    openlamellar()
    }
    if (document.layers) {
    for (i=0;i<=x_slices;i++) {
    var thisinners=eval("document.s"+i+".document")
    thisinners.write(content)
    thisinners.close()
    var thiss=eval("document.s"+i)
    thiss.left=x_finalpos
    thiss.top=y_finalpos
    }
    i_message++
    openlamellarNN()
    }
    }
    function openlamellar() {
    clipleft=-width_slice
    clipright=0
    if (i_clipright<=width_slice) {
    for (i=0;i<=x_slices;i++) {
    var thiss=eval("document.all.s"+i+".style")
    thiss.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
    clipleft+=width_slice
    clipright=clipleft+i_clipright
    }
    i_clipright++
    var timer=setTimeout("openlamellar()",20)
    }
    else {
    clearTimeout(timer)
    var timer=setTimeout("closelamellar()",3000)
    }
    }
    function openlamellarNN() {
    clipleft=-width_slice
    clipright=0
    if (i_clipright<=width_slice) {
    for (i=0;i<=x_slices;i++) {
    var thiss=eval("document.s"+i)
    thiss.clip.left=clipleft
    thiss.clip.right=clipright
    thiss.clip.top=cliptop
    thiss.clip.bottom=clipbottom
    clipleft+=width_slice
    clipright=clipleft+i_clipright
    }
    i_clipright++
    var timer=setTimeout("openlamellarNN()",20)
    }
    else {
    clearTimeout(timer)
    var timer=setTimeout("closelamellarNN()",3000)
    }
    }
    function closelamellar() {
    clipleft=-width_slice
    clipright=0
    if (i_clipright>=0) {
    for (i=0;i<=x_slices;i++) {
    var thiss=eval("document.all.s"+i+".style")
    thiss.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
    clipleft+=width_slice
    clipright=clipleft+i_clipright
    }
    i_clipright--
    var timer=setTimeout("closelamellar()",20)

    }
    else {
    clearTimeout(timer)
    var timer=setTimeout("changeimage()",1000)
    }
    }
    function closelamellarNN() {
    clipleft=-width_slice
    clipright=0
    if (i_clipright>=0) {
    for (i=0;i<=x_slices;i++) {
    var thiss=eval("document.s"+i)
    thiss.clip.left=clipleft
    thiss.clip.right=clipright
    thiss.clip.top=cliptop
    thiss.clip.bottom=clipbottom
    clipleft+=width_slice
    clipright=clipleft+i_clipright
    }
    i_clipright--
    var timer=setTimeout("closelamellarNN()",20)

    }
    else {
    clearTimeout(timer)
    var timer=setTimeout("changeimageNN()",1000)
    }
    }
    function changeimage() {
    content=""
    if (i_message>message.length-1) {i_message=0}
    content+="<table border="+borderwidth+" cellpadding='5' width="+textwidth+" height="+textheight+">"
    content+="<tr><td bgcolor="+bg_ticker+" align="+alignmessage[i_message]+">"
    content+="<img hspace=5 src="+messageimg[i_message]+" align="+alignimg[i_message]+" border='0'>"
    content+="<a href="+messageurl[i_message]+" target="+target_url+">"
    content+="<font face="+font_face+" size="+font_size+" color="+font_color+">"
    content+=message[i_message]
    content+="<\/font><\/a><\/td><\/tr><\/table>"
    for (i=0;i<=x_slices;i++) {
    var thisinners=eval("s"+i)
    thisinners.innerHTML=content
    }
    i_message++
    openlamellar()
    }
    function changeimageNN() {
    content=""
    if (i_message>message.length-1) {i_message=0}
    content+="<table border="+borderwidth+" cellpadding='5' width="+textwidth+" height="+textheight+">"
    content+="<tr><td bgcolor="+bg_ticker+" align="+alignmessage[i_message]+">"
    content+="<img hspace=5 src="+messageimg[i_message]+" align="+alignimg[i_message]+" border='0'>"
    content+="<a href="+messageurl[i_message]+" target="+target_url+">"
    content+="<font face="+font_face+" size="+font_size+" color="+font_color+">"
    content+=message[i_message]
    content+="<\/font><\/a><\/td><\/tr><\/table>"
    for (i=0;i<=x_slices;i++) {
    var thisinners=eval("document.s"+i+".document")
    thisinners.write(content)
    thisinners.close()
    }
    i_message++
    openlamellarNN()
    }
    // - End of JavaScript - -->
    //]]>
    </script>
    <style type="text/css">
    /*<![CDATA[*/
    span.c3 {font-family: Verdana,Arial,Helvetica; font-size: 64%}
    div.c2 {margin-bottom: 2px; margin-left: 2px}
    div.c1 {margin-left: 2%}
    /*]]>*/
    </style>


    ........later in the page this occurrs:

    <script type="text/javascript">
    //<![CDATA[
    <!-- Beginning of JavaScript -
    for (i=0;i<=x_slices;i++) {
    document.write("<span id='s"+i+"' class='s'><\/span>")
    }
    // - End of JavaScript - -->
    //]]>
    </script>

     
    Arco, Oct 18, 2005 IP
  2. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have no idea why this doesn't work.:)

    Assuming you cut and pasted this from somewhere it may be hard to fix, I suggest visiting www.dynamicdrive.com and finding another script that is more reliable.
     
    dave487, Oct 18, 2005 IP
  3. Arco

    Arco Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Checking the Firefox Java console it seems i'm getting "redeclaration" errors.
    For example:


    Warning: redeclaration of var thisinners
    Source File: http://www.erikfriedlander.com/index.shtm
    Line: 122, Column: 16
    Source Code:
    var thisinners=eval("document.s"+i+".document")
     
    Arco, Oct 18, 2005 IP
  4. fabulant

    fabulant Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This is very old script of mine. The new one (IE, Firefox, Chrome, Opera) can be downloaded for free:

    http://www.fabulant.com/downloadcenter/tickerandslideshow/tickerandslideshow.html

    Have fun
    Peter
     
    fabulant, Feb 2, 2011 IP