Javascript debugging mystery
I have 2 pretty similar page... the only difference is the images loaded in t开发者_如何学Gohe array... one work perfectly (rotating picture) the other error all the time :
Error: this.img is null
Source File: http://www.fibro.ca/js/blender.js
Line: 54
I check out thing.. copy/paste code and do all i can think of... no luck... do somebody have a divine illumination over that problem... ?
page that work : http://www.fibro.ca/html-ang/25-PIS-fiche.php?numero=1
page that error out : http://www.fibro.ca/html-ang/44-SPA-fiche.php?numero=1
They are not identical "except for the images"
The "page that works" is the one that is throwing the error you mentioned and some some incorrect javascript in it:
$("fichephoto").observe("click", function() {
running = !running;
if(running) { blender.start(); }
else { blender.stop(); }
});
new Blender("swapphoto", images, {fadeDuration: 1,displayDuration: 1});
});
Whats up with the extra Blender at the end? You are not setting it to a variable, so how would you be using it?
Also, it would help if you did some better indentation, makes the code a little easier to read.
You are missing:
new Blender("swapphoto", images, {fadeDuration: 1,displayDuration: 1});
精彩评论