I've been wrestling with this problem since yesterday, and I'm no closer to solving it than I was then.

Here's the scenario:
I have a page with two frames. A frame named 'menuFrame' at the top, and a frame named 'mainFrame' below.

'menuFrame' contains a table, named 'menu1'. It has one row with 6 cells in the row. Each cell has a different id.

The idea is that each cell contains a menu option which can either be 'on' or 'off' depending on its class.

I've been trying to write a JavaScript function called 'MenuSwitchOn(SwitchMenu)' which will do two things:
  1. It will set the class of all the cells to 'off'
  2. It will set the class of the cell specified by 'SwitchMenu' to 'on'.

Here's the function I came up with (it says PHP but it's really JavaScript):
PHP Code:
function MenuSwitchOn(switchMenu) {
menulength window.frames['menuFrame'].menuRow.cells.length;
    for (var 
i=0i<menulengthi++) {
window.frames['menuFrame'].menu1.rows[0].cells[i].class = 'off';
        if (
switchMenu && window.frames['menuFrame'].menu1.rows[0].cells[i].id==switchMenu) {
switchOn i;
switchMenu) { 
window.frames['menuFrame'].menu1.rows[0].cells[switchOn].class = 'on';

The problem is I keep getting an error "missing name after . operator" on the following line:
window.frames['menuFrame'].menu1.rows[0].cells[i].class = 'off';
Does anyone have any advice for me? I'm pretty new at JavaScript...