Jump to content

Javascript Problem on Firefox

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1
streulich

streulich

    Newbie

  • Members
  • Pip
  • 8 posts
On my website I have javascript for a rotating image. It works fine only on IE but doesn't rotate on any other browser. Any suggestions?

<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[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&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[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].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[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</Script>



Thanks!

#2
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
Hmm, looks fine from what I can tell. Are you sure that you have Javascript enabled in your other browsers? Where is a link with this code so I can test?

#3
streulich

streulich

    Newbie

  • Members
  • Pip
  • 8 posts
the website is www.softassociates.com. The images are in the top right-hand part of the home page.

#4
falco85

falco85

    Programmer

  • Members
  • PipPipPipPip
  • 105 posts
Are you talking about the Orange image that changes in IE?

#5
streulich

streulich

    Newbie

  • Members
  • Pip
  • 8 posts
yeah, the caption part is orange and above it says peoplesoft then two people then four blocks. any ideas?

#6
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
In FireFox it appears that your image src always has images/main/main01.gif - How is the javascript being called to change the image??

Can you give me the URL of where you got this script?

#7
streulich

streulich

    Newbie

  • Members
  • Pip
  • 8 posts
The Javascript was all handcoded, it didn't come from anywhere else. Everything is in the Source code.

#8
smith

smith

    Programmer

  • Members
  • PipPipPipPip
  • 153 posts
Your setTimeout does not work, that is the problem. I'm trying to figure out why it doesn't work right now.

for (int i;;) {

   cout << "Smith";

}


#9
smith

smith

    Programmer

  • Members
  • PipPipPipPip
  • 153 posts
The problem turned out to be your link function. Ok, problem solved. You need to change your goToLink() function to this:

function goToLink() { 
	var x=document.getElementsByName("dynalink");
	x.href = link;
} 

and it will work fine.

for (int i;;) {

   cout << "Smith";

}


#10
streulich

streulich

    Newbie

  • Members
  • Pip
  • 8 posts
awesome! thanks so much, i really appreciate it.

#11
Saint

Saint

    Learning Programmer

  • Members
  • PipPipPip
  • 63 posts
That is odd, why would it work in one but not the other? Don't they both use the same java?
Hi >> Saint