I was doing a website project for school, and I needed to do a simple image gallery. Very simple.
So I made an array to contain the paths for the images.
The code for the entire gallery looks like this:
function display(i){
var pictures = new Array();
pictures[0] = "images/when.png";
pictures[1] = "images/moody.jpg";
pictures[2] = "images/thousand.jpg";
pictures[3] = "images/morning.jpg";
pictures[4] = "images/now.jpg";
pictures[5] = "images/children.jpg";
pictures[6] = "images/free.jpg";
pictures[7] = "images/igtm.png";
pictures[8] = "images/sworcery.jpg";
pictures[9] = "images/scythian-steppes.jpg";
document.getElementById("album").setAttribute("src", pictures[i]);
}
This is the correct version, that works. However before this, I had made a typo on the last line of the array, so instead it said:
pitcures[9] = "images/scythian-steppes.jpg";
If I commented part of the array out, that contained this error, then the onclick in the html would work. If it wasn't commented out, it didn't work, and wouldn't change any of the pictures, even from the ones that were correctly written.
So I got a couple of questions.
1. Why did the rest of the pictures before that not show up? (aka. The last line in the array broke everything)
2. Dreamweaver didn't highlight it. Did it see it as a declaration?
3. Is there a way to avoid this in the future. If I would be doing a script on 100 lines or more, it would takes ages to find that error again.
Thank you for your time!
TL;DR I want better code highlighting in dreamweaver.

New Topic/Question
Reply


MultiQuote






|