Piece of cake. What you need (if you don't need n4 and oldies
compliance) is the W3C DOM.
With it you can dynamically build the menu. You could also use innerHTML
and innerText properties, which are non-standard but supported by IE and
I myself would go for the DOM. Basically what you need is
document.createElement and document.createTextNode.
You'll find some dom-related articles at alistapart.com and I think
there are some on webreference too. Shouldn't be hard to find once you
know what you're looking for.
This is really OT, you'd probably get more accurate help from