Javascript Problem on Firefox

Discussion in 'JavaScript' started by streulich, Oct 16, 2006.

  1. #1
    I have a rotating image using JS that only rotates on IE. Any ideas? the site is www.softassociates.com.

    <Script Language="Javascript">
    <!--
    var which="work.asp?c=1"

    function getURL(url){
    which = url
    }

    function transport(){
    window.location= which
    }


    function jPop(what) {
    apopWindow = window.open('textPopup.asp?w=' + what, 'jPop', 'width=450,height=550,toolbar=no,location=no,scrollbars=yes' )
    }
    // Slide Show Script
    // Set the slideshow speed (in milliseconds)
    var SlideShowSpeed = 3000;

    // Set the duration of crossfade (in seconds)
    var CrossFadeDuration = 3;

    var Picture = new Array(); // don't change this
    var Caption = new Array(); // don't change this

    // Specify the image files...
    // To add more images, just continue
    // the pattern, adding to the array below.
    // To use fewer images, remove lines
    // starting at the end of the Picture array.
    // Caution: The number of Pictures *must*
    // equal the number of Captions!

    Picture[1] = 'images/main/main01.gif';
    Picture[2] = 'images/main/main02.gif';
    Picture[3] = 'images/main/main03.gif';


    // Specify the Captions...
    // To add more captions, just continue
    // the pattern, adding to the array below.
    // To use fewer captions, remove lines
    // starting at the end of the Caption array.
    // Caution: The number of Captions *must*
    // equal the number of Pictures!

    Caption[1] = "work.asp?c=1&proj=A";
    Caption[2] = "work.asp?c=3&proj=A";
    Caption[3] = "work.asp?c=4&proj=A";


    // =====================================
    // Do not edit anything below this line!
    // =====================================

    var tss;
    var iss;
    var jss = 1;
    var pss = Picture.length-1;
    var link=Caption[jss]

    function goToLink() {
    window.dynalink.href = Caption[jss]
    }

    var preLoad = new Array();
    for (iss = 1; iss < pss+1; iss++){
    preLoad[iss] = new Image();
    preLoad[iss].src = Picture[iss];}

    function runSlideShow(){
    if (document.all){
    document.images.PictureBox.style.filter="blendTrans(duration=2)";
    document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
    document.images.PictureBox.filters.blendTrans.Apply();}
    document.images.PictureBox.src = preLoad[jss].src;
    if (document.all) document.images.PictureBox.filters.blendTrans.Play();
    goToLink()
    jss = jss + 1;
    if (jss > (pss)) jss=1;
    tss = setTimeout('runSlideShow()', SlideShowSpeed);
    }

    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
    }

    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
    }

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    </Script>

    Thanks!!
     
    streulich, Oct 16, 2006 IP
  2. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Because you're using some seriously inept code, which doesn't say much for a software company.
    Firefox reports the error 'dynalink has no properties' due to the incorrect reference tolerated by I.E. :
    , which should be:
    document.links['dynalink'].href= ...
    Code (markup):
    More classical incompetence:
    The test for document.all has no bearing on the availability of the methods being called, and will cause errors on other browsers.

    It's best to steer clear of scripts from submission sites, which the original author has usually long-since tired of supporting.
     
    Logic Ali, Oct 16, 2006 IP