PDA

View Full Version : image rotation


BossJames
06-22-2003, 12:42 AM
i have used this code before with different image names, this time it does not work, i have been through it a million times, do you see where i have made a mistake & what do i need to change to make it work.
thanks
james

_____
<head>
<script language="JAVASCRIPT" type="TEXT/JAVASCRIPT">

<!--
showboard = new Image(414,576)
showboard.src = ".images/showboardlee.jpg"
showboard = new Image(414,576)
showboard.src = ".images/showboardken.jpg"
showboard = new Image(414,576)
showboard.src = ".images/showboardcobra.jpg"
// -->


</script>
<script><!--
adImages = newArray
("images/showboardlee.jpg",
"images/showboardken.jpg",
"images/showboardcobra.jpg")
thisAd = 0
imgCt = adImages.length

function rotate() {
if (document.images) {
thisAd++
if (thisAd == imgCt) {
thisAd = 0
}
document.adshowboard.src=adImages[thisAd]
setTimeout("rotate()", 35 * 1000)
}
}
// -->
</script>
</head>

<body onload="rotate()">
<noscript>
Javascript slidshow - upgrade to newer browser or turn on javascript
</noscript>

<p><img src= "../images/showboardlee.jpg" , width="414" height="576" name="adshowboard"></p>

Steven_Smith
06-22-2003, 02:49 AM
try this

<head>
<script language="JAVASCRIPT" type="TEXT/JAVASCRIPT">

<!--
showboard = new Image(414,576)
showboard.src = ".images/showboardlee.jpg"
showboard = new Image(414,576)
showboard.src = ".images/showboardken.jpg"
showboard = new Image(414,576)
showboard.src = ".images/showboardcobra.jpg"

adImages = newArray
("images/showboardlee.jpg",
"images/showboardken.jpg",
"images/showboardcobra.jpg")
thisAd = 0
imgCt = adImages.length

function rotate() {
if (document.images) {
thisAd++
if (thisAd == imgCt) {
thisAd = 0
}
document.adshowboard.src=adImages[thisAd]
setTimeout("rotate()", 35 * 1000)
}
}
// -->
</script>
</head>

<body onload="rotate()">
<noscript>
Javascript slidshow - upgrade to newer browser or turn on javascript
</noscript>

<p><img src= "../images/showboardlee.jpg" width="414" height="576" name="adshowboard"></p>

BossJames
06-25-2003, 12:15 AM
this is the message i got when i used your changes,
any suggestions?

JavaScript Error:
file:/%20working%20disk%20%232/or_elcamino%20%C4/or_elcamino/pages/Temporary%24%24%24.html, line 16:

newArray is not defined.
JavaScript Error:
file:/%20working%20disk%20%232/or_elcamino%20%C4/or_elcamino/pages/Temporary%24%24%24.html, line 22:

thisAd is not defined.

cheesebagpipe
06-25-2003, 12:19 AM
Pretty good clues....

adImages = new Array....

You're calling a (constructor) function, using the new keyword to generate an (array) object.

BossJames
06-25-2003, 01:00 AM
http://www.chevelles.net/oregon/pages/showboards.html

thanks for the spacing tip - now the page comes up but the images do not rotate from first one.
to look try url above
thanks
james

cheesebagpipe
06-25-2003, 01:20 AM
Looks like your path to the images directory is incorrect....

adImages = new Array("../images/showboardlee.jpg","../images/showboardken.jpg","../images/showboardcobra.jpg");

The 'preloader' got it correct, but it's debatable whether its preloading or not.

cheesebagpipe
06-25-2003, 01:29 AM
<body onload="setTimeout('rotate()', 35 * 1000)">

:D I saw that...

BossJames
06-25-2003, 04:13 PM
your right, the image paths needed: ../ & your catch on the missing space in new Array to make it work. thanks for the help.
james