Hi all, I've got the below code...
var ToggleButtons=new Array();
ToggleButtons[0] = "#Click";
ToggleButtons[1] = "#DoubleClick";
ToggleButtons[2] = "#Drag";
ToggleButtons[3] = "#RightClick";
ToggleButtons[4] = "#MiddleClick";
function SelectButton(id) {
var x = 0;
for (x = 0; x++; x < ToggleButtons.length) {
if (x == id) {
$(ToggleButtons[x]).addClass('ToggleButtonSelected');
} else {
$(ToggleButtons[x]).removeClass('ToggleButtonSelected');
}
}
}
however, when I call SelectButton(n) with n=0->4, it hits the for() line and jumps straight to the closing brace.
on the for() line before it executes, Firebug shows (eg)
id=2
ToggleButtons.length=5
x=0
I've got the feeling I'm missing something obvious but I'm not sure what,
Many thanks