| re: For loop error - object expected
undercups wrote:[color=blue]
> When I run page I immediatley get "Object expected" message and the tag
> <body onload="setfocus()" is highlighted.
>
> The error occurs in this snippet from within the script file
>
> function validatePage()
> {
> // select the items in the TeamDivisions listbox
> var i=document.TeamMaintenance.TeamDivisions.options.l ength -1
> For (i; i>=0; i--)
> {document.TeamMaintenance.hiddenTeamDivisions.valu e +=
> document.TeamMaintenance.TeamDivisions.options[i].value;
> document.TeamMaintenance.hiddenTeamDivisions.value += ",";}
>[/color]
Try this:
// select the items in the TeamDivisions listbox
var x = [];
var f = document.TeamMaintenance.TeamDivisions.options;
var i = f.length;
while (i--){ x.push(f[i].value) }
document.TeamMaintenance.hiddenTeamDivisions.value = x.join(',');
[color=blue]
> // Now validate the page
> return validatePanels();
> }
>[/color]
[...]
--
Rob |