1:部分




    
    Document
    <script type="text/javascript" src="jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="Window.js"></script>
    





2:css部分

*{
    margin: 0px;
    padding: 0px;
    font-family: "微软雅黑";
    font-size: 14px;
}
body{
    background-color: #3b3c32;
    padding-top: 100px;
}
#window{
    width: 1200px;
    height: auto;
    margin: 0 auto;
}
ul{
    list-style: none;
    /*float: left;*/
    position: relative;
}
ul>ul{
    margin-left: 60px;
    height: auto;
}
span.type{
    font-weight: bolder;
    width: 400px;
    height: 30px;
    float: left;
    cursor: default;
}
span.object0{
    color: green;
    cursor: pointer;
}
span.object1{
    color: green;
    cursor: pointer;
}
span.object2{
    color: green;
    cursor: pointer;
}
span.object3{
    color: green;
    cursor: pointer;
}
span.object4{
    color: green;
    cursor: pointer;
}
span.object5{
    color: green;
    cursor: pointer;
}
span.function{
    color: brown;
}
span.number{
    color: #0b6694;
}
span.string{
    color: yellowgreen;
}
span.boolean{
    color: turquoise;
}
h4{
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: bolder;
}
li{
    height: 30px;
    line-height: 30px;
    float: left;
    width: 100%;
    color: turquoise;
    /*background-color: #808080;*/
    /*border-bottom: 1px solid white;*/
    overflow: hidden;
    /*background-color: lightseagreen;*/
}


3:js部分

$(function(){
    function printObj(obj,title,after,dept){

        var html = '';
        //html += '

'+title+'

'; html += '
    '; //document.write('
    '); //document.write('

    '+title+'

    '); for(pro in obj) { if (pro != 'printObj') { var type = typeof obj[pro]; html += '
  • '; html += ''+ title + '.[' + type + ']' +title+'.' + pro + ' = ' + obj[pro] + '
    '; html += '
  • '; } } html += '


' if(after == ''){ $("body").after(html); }else{ $(after).parent().after(html); } $(".object"+dept).bind('click',function(){ if(parseInt($(this).attr("opened")) == 1){ if($(this).parent().next().is("ul")){ var id = $(this).parent().next().attr("id"); //alert(id); $("#"+id).css('display','none'); $(this).attr("opened",'0'); return false; } }else if(parseInt($(this).attr("opened")) == 0){ if($(this).parent().next().is("ul")){ var id = $(this).parent().next().attr("id"); $("#"+id).css('display','block'); $(this).attr("opened",'1'); return false; } }else { var dept = $(this).attr("dept"); $(this).attr("opened", '1'); if (dept == 0) { var obj1 = $(this).attr("object1"); if (window[obj1] == null) { alert('window.' + obj1 + ' is an object but null !!!'); return false; } printObj(window[obj1], 'window-' + obj1, this, 1); } else if (dept == 1) { var obj1 = $(this).attr("object1"); var obj2 = $(this).attr("object2"); if (window[obj1][obj2] == null) { alert('window.' + obj1 + '.' + obj2 + ' is an object but null !!!'); return false; } printObj(window[obj1][obj2], 'window-' + obj1 + '-' + obj2, this, 2); } else if (dept == 2) { var obj1 = $(this).attr("object1"); var obj2 = $(this).attr("object2"); var obj3 = $(this).attr("object3"); if (window[obj1][obj2][obj3] == null) { alert('window.' + obj1 + '.' + obj2 + '.' + obj3 + ' is an object but null !!!'); return false; } printObj(window[obj1][obj2][obj3], 'window-' + obj1 + '-' + obj2 + '-' + obj3, this, 3); } else if (dept == 3) { var obj1 = $(this).attr("object1"); var obj2 = $(this).attr("object2"); var obj3 = $(this).attr("object3"); var obj4 = $(this).attr("object4"); if (window[obj1][obj2][obj3][obj4] == null) { alert('window.' + obj1 + '.' + obj2 + '.' + obj3 + '.' + obj4 + ' is an object but null !!!'); return false; } printObj(window[obj1][obj2][obj3][obj4], 'window-' + obj1 + '-' + obj2 + '-' + obj3 + '-' + obj4, this, 4); } else if (dept == 4) { var obj1 = $(this).attr("object1"); var obj2 = $(this).attr("object2"); var obj3 = $(this).attr("object3"); var obj4 = $(this).attr("object4"); var obj5 = $(this).attr("object5"); if (window[obj1][obj2][obj3][obj4][obj5] == null) { alert('window.' + obj1 + '.' + obj2 + '.' + obj3 + '.' + obj4 + '.' + obj5 + ' is an object but null !!!'); return false; } printObj(window[obj1][obj2][obj3][obj4][obj5], 'window-' + obj1 + '-' + obj2 + '-' + obj3 + '-' + obj4 + '-' + obj5, this, 5); } } return false; }); } //alert('aaa'); printObj(window,'window','',0); });