compare value of javascript variable...
Posted: Mon Nov 29, 2004 10:53 pm
Hi,
I've been sitting at my computer screen for hours now... I've generated a slideshow and I'm trying my darndest to change the image of the active links to show what slide the user is on. I've got that covered - my problem is that I can't seem to accurately compare the variable of the current slide to the counter I've got. Here's my code. Any suggestions would be absolutely BRILLIANT!
Then, within the body, I call the showLinks() function:
I've been sitting at my computer screen for hours now... I've generated a slideshow and I'm trying my darndest to change the image of the active links to show what slide the user is on. I've got that covered - my problem is that I can't seem to accurately compare the variable of the current slide to the counter I've got. Here's my code. Any suggestions would be absolutely BRILLIANT!
Code: Select all
<script type="text/javascript">
var photos=new Array()
var photoslink=new Array()
var which=1
var currNum = 1
var imageNum=1
//define images. You can have as many as you want:
photosї1]="images/ir1.jpg";
photosї2]="images/ir3.jpg";
photosї3]="images/ir4.jpg";
photosї4]="images/ir5.jpg";
photosї5]="images/ir6.jpg";
photosї6]='images/ir7.jpg';
photosї7]='images/ir8.jpg';
photosї8]='images/ir9.jpg';
photosї9]='images/ir10.jpg';
photosї10]='images/ir11.jpg';
photosї11]='images/ir12.jpg';
photosї12]='images/ir13.jpg';
photosї13]='images/ir14.jpg';
photosї14]='images/ir15.jpg';
photosї15]='images/ir16.jpg';
photosї16]='images/ir17.jpg';
photosї17]='images/ir18.jpg';
photosї18]='images/ir19.jpg';
photosї19]='images/ir20.jpg';
photosї20]='images/ir21.jpg';
photosї21]='images/ir22.jpg';
photosї22]='images/ir23.jpg';
photosї23]='images/ir24.jpg';
photosї24]='images/ir25.jpg';
photosї25]='images/ir26.jpg';
photosї26]='images/ir27.jpg';
photosї27]='images/ir28.jpg';
photosї28]='images/ir29.jpg';
photosї29]='images/ir30.jpg';
photosї30]='images/ir31.jpg';
photosї31]='images/ir32.jpg';
photosї32]='images/ir33.jpg';
photosї33]='images/ir34.jpg';
photosї34]='images/ir35.jpg';
photosї35]='images/ir36.jpg';
photosї36]='images/ir37.jpg';
photosї37]='images/ir38.jpg';
photosї38]="images/ir39.jpg";
//Specify whether images should be linked or not (1=linked)
var linkornot=0
//do NOT edit pass this line
var preloadedimages=new Array()
for (i=0;i<photos.length;i++){
preloadedimagesїi]=new Image()
preloadedimagesїi].src=photosїi]
}
function applyeffect(){
if (document.all && photoslider.filters){
photoslider.filters.revealTrans.Transition = 7
photoslider.filters.revealTrans.stop()
photoslider.filters.revealTrans.apply()
}
}
function playeffect(){
if (document.all && photoslider.filters)
photoslider.filters.revealTrans.play()
}
function keeptrack(){
window.status="Image "+(which+1)+" of "+photos.length
}
function backward(){
if(which==0) which =photos.length-1
if (which>1){
which--
document.images.photoslider.src=photosїwhich]
counter()
keeptrack()
}
}
function forward(){
if(which>photos.length-1) which = 0
if (which<photos.length-1){
which++
document.images.photoslider.src=photosїwhich]
counter()
keeptrack()
}
}
function photoNum(num){
which = num
document.images.photoslider.src=photosїwhich]
counter()
keeptrack()
}
function transport(){
window.location=photoslinkїwhich]
}
function counter()
{
imageNum++
}
function showLinks()
{
for (var i=1; i <= 38; i++ ) {
if(i == imageNum){
document.write('<a href="javascript:photoNum('+i+');" style="background:#435607;color:#ffffff;">'+i+'</a> ');
}
if(i==12)
{
document.write('<br /><a href="javascript:photoNum('+i+');">'+i+'</a> ')
}
if(i==24)
{
document.write('<br /><a href="javascript:photoNum('+i+');">'+i+'</a> ')
}
else
{
document.write('<a href="javascript:photoNum('+i+');">'+i+'</a> ')
}
}
}
</script>Code: Select all
showLinks()