- 论坛徽章:
- 0
|
- <style>
-
.hide {
-
-
display:none;
-
}
-
.show {
-
display:block;
-
}
-
</style>
-
-
<script type="text/javascript">
-
-
var EventUtil = {
-
-
addHandler: function(element, type, handler){
-
if (element.addEventListener){
-
element.addEventListener(type, handler, false);
-
}
-
else if (element.attachEvent) {
-
element.attachEvent("on"+type, handler);
-
}
-
else {
-
element["on"+type] = handler;
-
}
-
},
-
-
removeHandler: function(element, type, handler){
-
if (element.removeEventListener){
-
element.removeEventListener(type, handler, false);
-
}
-
else if (element.detachEvent){
-
element.detachEvent("on"+type, handler);
-
}
-
else {
-
element["on"+type] = null;
-
}
-
},
-
-
getEvent: function(event) {
-
return event ? event : window.event;
-
},
-
-
getTarget: function(event) {
-
return event.target || event.srcElement;
-
}
-
-
}
-
-
-
function change(event) {
-
var event = event;
-
var element = this;
-
var odiv = EventUtil.getTarget(event).getElementsByTagName("div").item(0);
-
//alert(odiv.tagName);
-
var CName = element.className;
-
//var divCName = odiv.getElementByTagName("div").item(0).className;
-
//alert(divCName);
-
if(CName == "level_1"){
-
element.className = "level_2";
-
odiv.className = "show"
-
}
-
else
-
{
-
element.className = "level_1";
-
odiv.className = "hide";
-
}
-
-
}
-
-
window.onload=function(){
-
var ou=document.getElementById("content_left_colume").getElementsByTagName("ul") ;
-
-
//alert(ou.length);
-
for (var i=0 ; i<ou.length ;i++){
-
//alert(ou.item(i).tagName);
-
EventUtil.addHandler(ou.item(i),"click",change);
-
}
-
}
-
-
</script>
-
<div id="content_left_colume">
-
-
<ul class="level_1">
-
<li >11111
-
<div class="hide">
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
</div>
-
</li>
-
</ul>
-
<ul class="level_1">
-
<li >11111
-
<div class="hide">
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
</div>
-
</li>
-
</ul>
-
<ul class="level_1">
-
<li >11111
-
<div class="hide">
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
<a href=#>222222222</a>
-
</div>
-
</li>
-
</ul>
-
-
</div>
|
|