P
pierre
Hi,
Since saturday I'm trying to find a bug.
In the script below onClick="switch_photos('first')" and
onClick="switch_photos('last')" work fine.
However onClick="switch_photos('prev') and
onClick="switch_photos('next')" don't (no pictures)
Would anybody be so kind to to help me finding this bug?
Thanks for your kind help
Pierre
------------------------------------------------------------------
<SCRIPT>
function switch_photos(param){
var current_image;
var prev_image=-1;
var next_image=-1;
image_id=document.getElementById("sImg");
if (images_list.length>0)
{
for (i=0;i<images_list.length;i++)
{
if (image_id.src==images_list)
{
current_image=i;
if (i!=1)//if the first image=>there
is no previous
prev_image=i-1;
else
prev_image=images_list.length-1;
if (i!=(images_list.length-1))//if
last image=>there is no next
next_image=i+1;
else
next_image=1;
}
}
}
if(param=="prev")
image_id.src=images_list[prev_image];
if(param=="next")
image_id.src=images_list[next_image];
if(param=="first")
image_id.src=images_list[1];
if(param=="last")
image_id.src=images_list[((images_list.length)-1)];
}
var images_list = new Array();
images_list[1]="da1.jpg";
images_list[2]="da2.jpg";
images_list[3]="da3.jpg";
images_list[4]="da4.jpg";
images_list[5]="da5.jpg";
images_list[6]="da6.jpg";
images_list[7]="da7.jpg";
images_list[8]="da8.jpg";
images_list[9]="da9.jpg";
images_list[10]="da10.jpg";
images_list[11]="da11.jpg";
function resizeWindow() {
img = document.getElementById("sImg");
if (img != null) {
if (document.all)
{w = img.width + 30; h = img.height + 110; }
else
{w = img.width + 20; h = img.height + 80; }
window.resizeTo(w, h);
}
}
</SCRIPT>
Since saturday I'm trying to find a bug.
In the script below onClick="switch_photos('first')" and
onClick="switch_photos('last')" work fine.
However onClick="switch_photos('prev') and
onClick="switch_photos('next')" don't (no pictures)
Would anybody be so kind to to help me finding this bug?
Thanks for your kind help
Pierre
------------------------------------------------------------------
<SCRIPT>
function switch_photos(param){
var current_image;
var prev_image=-1;
var next_image=-1;
image_id=document.getElementById("sImg");
if (images_list.length>0)
{
for (i=0;i<images_list.length;i++)
{
if (image_id.src==images_list)
{
current_image=i;
if (i!=1)//if the first image=>there
is no previous
prev_image=i-1;
else
prev_image=images_list.length-1;
if (i!=(images_list.length-1))//if
last image=>there is no next
next_image=i+1;
else
next_image=1;
}
}
}
if(param=="prev")
image_id.src=images_list[prev_image];
if(param=="next")
image_id.src=images_list[next_image];
if(param=="first")
image_id.src=images_list[1];
if(param=="last")
image_id.src=images_list[((images_list.length)-1)];
}
var images_list = new Array();
images_list[1]="da1.jpg";
images_list[2]="da2.jpg";
images_list[3]="da3.jpg";
images_list[4]="da4.jpg";
images_list[5]="da5.jpg";
images_list[6]="da6.jpg";
images_list[7]="da7.jpg";
images_list[8]="da8.jpg";
images_list[9]="da9.jpg";
images_list[10]="da10.jpg";
images_list[11]="da11.jpg";
function resizeWindow() {
img = document.getElementById("sImg");
if (img != null) {
if (document.all)
{w = img.width + 30; h = img.height + 110; }
else
{w = img.width + 20; h = img.height + 80; }
window.resizeTo(w, h);
}
}
</SCRIPT>