
Originally Posted by
starlameris
var manualPictures = new Array();
Associative arrays do not exist in ECMAScript. Use an object instead. This still doesn't provide an associative array, but it does provide something similar.
{
  document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
  document.getElementById(pictureName).filters.blendTrans.Apply();
}
It seems that you're missing some of this code out, because block statements aren't much use in ECMAScript (unlike some other languages where they alter scope).
I expect that this is supposed to be preceeded by an if statement. If that statement involves a proper feature test, then there should be no problems. If you're trying to detect IE (and browser detection is almost always wrong), then you're probably going to run into problems.
Try subsituting your code for that below.
  manualPictures[pictureName] =
    imageFiles.substring(imageSeparator+1,imageFiles.length)
    + ';' + nextImage;
It's not necessary to pass a second argument to the substring method if you're obtaining all characters up to the end of the string.
Code:
var manualPictures = {};
function nextImageSlide(pictureName, imageFiles) {
var imageSeparator, nextImage, picture;
if(!manualPictures[pictureName]) {
manualPictures[pictureName] = imageFiles;
} else {
imageFiles = manualPictures[pictureName];
}
imageSeparator = imageFiles.indexOf(";");
nextImage = imageFiles.substring(0, imageSeparator);
if(document.images) {
picture = document.images[pictureName];
}
if(picture) {
if(picture.style && picture.filters) {
picture.style.filter="blendTrans(duration=2)";
picture.filters.blendTrans.Apply();
}
picture.src = nextImage;
if(picture.filters) {
picture.filters.blendTrans.Play();
}
}
manualPictures[pictureName] = imageFiles.substring(imageSeparator + 1)
+ ';' + nextImage;
}
As you haven't shown how this code is to be used, I can't effectively test it, so I'll leave that to you.
Hope that helps,
Mike
Bookmarks