views:

23

answers:

2

I'm trying to create a drop down menu similar to what you would see with a 'ul'.

The difference being I want to do it with a table.

When the page loads I have td's with their 'display' attribute equal to 'none'. This hides the td for me.

The problem is in the javascript below.

function displayMenuOptions() {
            var _1 = document.getElementById("1");
            var _2 = document.getElementById("2");
            var _3 = document.getElementById("3");

            _1.setAttribute("style", "display : block");
            _2.setAttribute("style", "display : block"); 
            _3.setAttribute("style", "display : block"); 
}

This function is being fired by a mouseover on another td with an 'a' child element.

This javascript is not displaying the td's I originally had hidden.

Ideas?

A: 

IDs cannot begin with numbers -- change them to be cell_1, cell_2, cell_3, etc. and everything should just work.

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

SEE: http://www.w3.org/TR/html4/types.html#h-6.2

Sean Vieira
+1  A: 
_1.style.display = "block";
Mark Baijens