Connecting Tech Pros Worldwide Forums | Help | Site Map

javascript cycling graphic does not work on MAC IE

robbiehenry@gmail.com
Guest
 
Posts: n/a
#1: Sep 20 '05
1. robbiehe...@gmail.com Sep 19, 1:48 pm show options

From: robbiehe...@gmail.com - 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/...uates&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">


Sandman
Guest
 
Posts: n/a
#2: Sep 20 '05

re: javascript cycling graphic does not work on MAC IE


In article <1127225088.607232.61820@g44g2000cwa.googlegroups. com>,
robbiehenry@gmail.com wrote:
[color=blue]
> 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.[/color]


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

--
Sandman[.net]
Christopher Benson-Manica
Guest
 
Posts: n/a
#3: Sep 20 '05

re: javascript cycling graphic does not work on MAC IE


Sandman <mr@sandman.net> wrote:
[color=blue]
> Is IE for Mac important to you? It's ancient, and practically no one uses it
> anymore.[/color]

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.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Stephen Chalmers
Guest
 
Posts: n/a
#4: Sep 20 '05

re: javascript cycling graphic does not work on MAC IE


<robbiehenry@gmail.com> wrote in message news:1127225088.607232.61820@g44g2000cwa.googlegro ups.com...
[color=blue]
>I works on all browsers that i can get my hands on for pc and mac
>except ie for mac.[/color]

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];
}
}

--
S.C.





Closed Thread