On Apr 17, 5:38 am, "scripts.contac t" <scripts.cont.. .@gmail.com>
wrote:
On Apr 15, 11:31 pm, rajachezh...@gm ail.com wrote:
hello,
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.
some simple example;;; works in ie6,ff2,opera9
...
or---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator " content="PSPad editor, www.pspad.com">
<title></title>
<style>
#menuTop,#menuT op ul{cursor:defau lt;list-style-type:circle}
#menuTop .m{list-style-type:square}
</style>
<script>
function showHide(elem){
elem=elem.getEl ementsByTagName ("UL")[0]
if(!elem)return ;
elem=elem.style ;
elem.display=(e lem.display!='b lock')?'block': 'none'
}
if(document.cre ateStyleSheet){
var styleSheet=docu ment.createStyl eSheet();
styleSheet.addR ule("#menuTop ul","display:no ne")
}else if(document.cre ateElement){
var styleSheet=docu ment.createElem ent("style")
styleSheet.type ="text/css"
styleSheet.text Content="#menuT op ul{display:none }"
document.getEle mentsByTagName( "head")
[0].appendChild(st yleSheet)
}
</script>
</head>
<body>
<ul onclick="showHi de(event.target ||event.srcElem ent)" id="menuTop">
<li>Menu a</li>
<li>Menu b</li>
<li class="m">Menu c
<ul>
<li>Menu ca</li>
<li class="m">Menu cb
<ul>
<li>Menu cca</li>
<li>Menu ccb</li>
<li>Menu ccc</li>
</ul>
</li>
<li>Menu cd</li>
</ul>
</li>
<li>Menu d</li>
<li class="m">Menu e
<ul>
<li>Menu ea</li>
<li>Menu eb</li>
<li>Menu ev</li>
</ul>
</li>
<li>Menu f</li>
</ul>
</body>
</html>
the document will look good and show all the menus if either
javascript OR css is disabled :)