I have a web page with this script:
<script type="text/javascript">
function switchit(list){
var listElementStyle=document.getElementById(list).style;
if (listElementStyle.display=="none"){
listElementStyle.display="block";
}
else {
listElementStyle.display="none";
}
}
</script>
I use it to make a collapsible list of items in a navbar. The only problem is that when the items first load on the page, they are expanded. I would like them to load collapsed, then be able to expand the list by clicking on them.
How do I make them load on the page, already collapsed?
Btw, each link is labeled with <a href="javascript:switchit('List1')">Name of Item</a> .
<script type="text/javascript">
function switchit(list){
var listElementStyle=document.getElementById(list).style;
if (listElementStyle.display=="none"){
listElementStyle.display="block";
}
else {
listElementStyle.display="none";
}
}
</script>
I use it to make a collapsible list of items in a navbar. The only problem is that when the items first load on the page, they are expanded. I would like them to load collapsed, then be able to expand the list by clicking on them.
How do I make them load on the page, already collapsed?
Btw, each link is labeled with <a href="javascript:switchit('List1')">Name of Item</a> .