PDA

View Full Version : Difficulty With CSS/JS Menus. Help?




michaelrjohnson
Jul 19, 2005, 11:58 AM
Alright MR. I could really use some assistance.

I'm trying to create some very simple expanding/collapsing menus a la ALA articles old (http://old.alistapart.com/stories/dom2/), and new (http://www.alistapart.com/articles/domtricks2/). However, I'm having some difficulty. I'm a javascript beginner, but fluent in HTML and CSS.

I'm looking for a cross-platform/cross-browser compatible menu system. I just need some assistance in getting the JS in order.

Might anyone be able to help me further?



michaelrjohnson
Jul 19, 2005, 12:01 PM
This type functions, though, I used a (now relativley) old Visual Quickstart Guide to get me to here. Apparently, document.all isn't standard, and it's been replaced by document.getElementById... but I've not been able to get it to work with that syntax.

<html>
<head>
<style type="text/css">

#menu1 {
display: none;
}
#menu2 {
display: none;
}
</style>
</head>
<body>

<span onclick="if (document.all.menu1.style.display == 'block') {document.all.menu1.style.display='none';} else {document.all.menu1.style.display='block';}">

<b>Menu1</b> </span> <br>
<span id="menu1">
option 1<br>
option 2<br>
option 3<br>
</span>
<p>

Option 4<br>

</body>
</html>