javascript cycling graphic does not work on MAC IE

R

robbiehenry

1. (e-mail address removed) Sep 19, 1:48 pm show options

From: (e-mail address removed) - Find messages by this author
Date: Mon, 19 Sep 2005 10:48:50 -0700
Local: Mon, Sep 19 2005 1:48 pm
Subject: javascript cycling graphic does not work on MAC IE
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

I built this page for my company's corporate website
(http://www.otpp.com/web/website.nsf/web/newgraduates&students)


The second graphic down in the content area is a cycling graphic. Upon
page reload one of 3 banner graphics randomly loads on the page.


I works on all browsers that i can get my hands on for pc and mac
except ie for mac.


Can someone help me to figure out why it doesn't work and provide a
solution for me?


Thanks


Here is the code


jsheader:
<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers


myPix = new
Array("../web/bennertestimonial/$FILE/bennertestimonial.jpg","../web/cheung­testimonial/$FILE/cheungtestimonial.jpg","../web/ttrottestimonial/$FILE/ttr­ottestimonial.jpg")

imgCt = myPix.length


function choosePic() {
if (document.images) {
randomNum = Math.floor((Math.random() * imgCt))
document.myPicture.src = myPix[randomNum]



}
}


// End hiding script from old browsers -->
</script>

body tag:
onload="choosePic()"


image tag:
<img src="../web/spacer/$FILE/spacer.gif" width="565" height="177"
alt="" border="0" name="myPicture">
 
S

Sandman

The second graphic down in the content area is a cycling graphic. Upon
page reload one of 3 banner graphics randomly loads on the page.


I works on all browsers that i can get my hands on for pc and mac
except ie for mac.


Is IE for Mac important to you? It's ancient, and practically no one uses it
anymore.
 
C

Christopher Benson-Manica

Sandman said:
Is IE for Mac important to you? It's ancient, and practically no one uses it
anymore.

Unfortunately (for me at least), there are still people running Mac OS
9 and below using IE 5.1.7; they occasionally bring its bloated
carcass to our website, and I have to step carefully around its
innumerable stupid quirks. Whether one wishes to cater to the
wretched souls still running these browsers is a matter of personal
taste, but they do exist.
 
S

Stephen Chalmers

I works on all browsers that i can get my hands on for pc and mac
except ie for mac.

I assume js and error reporting were enabled.

When you reference an image, it's safer to do so via document.images
but that may not be the problem.

I suggest alerting the length of the array, the value returned by
Math.random and the resolved source path:

function choosePic()
{
if (document.images)
{
randomNum = Math.floor((Math.random() * imgCt))

alert("myPix.length: "+myPix.length+'\n\nrandomNum: ' + randomNum +"\n\nsrc=" + myPix[randomNum]);

document.images['myPicture'].src = myPix[randomNum];
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top