T
Trevor L.
BlankI am reposting this because it got lost under the Microsoft MVP discussion thread
Anyone, can you tell me what changes I have to make to this code so that it
would work in all (most) browsers
Javascript
function chgImg(direction)
/****
direction positions to
--------- ------------
-100 first image
1000 last image
-1 previous image
1 next image
1000 + i image i (i > 0)
****/
{
var ImgLength = Slides.length - 1
ImgNum =
(direction <= -100) ? 0
: (direction >= 1000) ? (direction - 1001)
: ImgNum + direction
ImgNum =
(ImgNum > ImgLength) ? 0
: (ImgNum < 0) ? ImgLength
: ImgNum
document.SlideShow.src = Slides[ImgNum]
document.getElementById('ImgText').innerHTML = (ImgNum + 1) + '/' +
Captions.length
+ ' ' + Captions[ImgNum]
}
This function is called with parameter direction to display the next image.
ImgNum is a global variable pointing to the last image.
Slides is an array of image names.
Captions is an array of captions.
HTML
<img class="none" src="images/wait.gif" alt="" name="SlideShow"><br>
<span id="ImgText">START</span><br>
My feeling that getElementByID is illegal in Netscape and therefore possibly
in Firefox. Is document.SlideShow.src also illegal?
--
Cheers,
Trevor L.
I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html
Anyone, can you tell me what changes I have to make to this code so that it
would work in all (most) browsers
Javascript
function chgImg(direction)
/****
direction positions to
--------- ------------
-100 first image
1000 last image
-1 previous image
1 next image
1000 + i image i (i > 0)
****/
{
var ImgLength = Slides.length - 1
ImgNum =
(direction <= -100) ? 0
: (direction >= 1000) ? (direction - 1001)
: ImgNum + direction
ImgNum =
(ImgNum > ImgLength) ? 0
: (ImgNum < 0) ? ImgLength
: ImgNum
document.SlideShow.src = Slides[ImgNum]
document.getElementById('ImgText').innerHTML = (ImgNum + 1) + '/' +
Captions.length
+ ' ' + Captions[ImgNum]
}
This function is called with parameter direction to display the next image.
ImgNum is a global variable pointing to the last image.
Slides is an array of image names.
Captions is an array of captions.
HTML
<img class="none" src="images/wait.gif" alt="" name="SlideShow"><br>
<span id="ImgText">START</span><br>
My feeling that getElementByID is illegal in Netscape and therefore possibly
in Firefox. Is document.SlideShow.src also illegal?
--
Cheers,
Trevor L.
I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html