如下,请问大家是什么意思,看不懂
<script type="text/javascript">
ddaccordion.init({
    headerclass: "submenuheader", //Shared CSS class name of headers group
    contentclass: "submenu", //Shared CSS class name of contents group
    revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click","clickgo", or "mouseover"
    mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
    onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
    animatedefault: false, //Should contents open by default be animated into view?
    persiststate: true, //persist state of opened contents within browser session?
    toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    togglehtml: ["suffix", "<img src='images/plus.png' class='statusicon' />", "<img src='images/minus.png' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
    animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
    oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
        //do nothing
    },
    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
        //do nothing
    }
})
</script>

解决方案 »

  1.   

    这个就是执行ddaccordion.init方法啊,参数就是那个一大坨
      

  2.   

    估计你是不知道javaScript中的()运算符的意思
    看看
      

  3.   

    <script type="text/javascript">
    ddaccordion.init({
        headerclass: "submenuheader", 
        contentclass: "submenu", 
        revealtype: "click", 
        mouseoverdelay: 200, 
        collapseprev: true,
        defaultexpanded: [], 
        onemustopen: false, 
        animatedefault: false,
        persiststate: true, 
        toggleclass: ["", ""],
        togglehtml: ["suffix", "<img src='images/plus.png' class='statusicon' />", "<img src='images/minus.png' class='statusicon' />"],
        animatespeed: "fast", 
        oninit:function(headers, expandedindices){
            //do nothing
        },
        onopenclose:function(header, index, state, isuseractivated){ 
            //do nothing
        }
    })
    </script>
    我也知道这是一个函数,但是我以前还从来没有见过这样的写法,里面参数冒号后面的是不是赋值啊
      

  4.   

    奇怪的是里面还有2个函数
    oninit:function(headers, expandedindices){
      //do nothing
      },
      onopenclose:function(header, index, state, isuseractivated){ 
      //do nothing
      }
      

  5.   

    ddaccordion.init这个函数被执行了该函数只有一个参数 Object类型
    {}配置对象写法,生成的是一个Object类型变量例如:
    var obj={name:'name',value:'1',eat:function(){}};
    等价于:
    var obj=new Object();
    obj.name='name';obj.value='1';obj.eat=function(){};{}里面配置了一个对象作为ddaccordion.init的参数,明白了么?
      

  6.   

    这个是ddaccordion这个对象的初始化
    该方法肯定是在设计一个javascript插件,而这个函数就是为了初始化这个插件要使用的一些变量
    好处主要是:可以统一化设置参数,代码看起来清爽!如果在插件各处都使用var定义一些变量的话,你会觉得代码没有逻辑性!
      

  7.   

    跟java中的类很相似,里面有自己的属性,有自己的方法
      

  8.   

    var initOjb = {
      headerclass: "submenuheader", //Shared CSS class name of headers group
      contentclass: "submenu", //Shared CSS class name of contents group
      revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid    value: "click","clickgo", or "mouseover"
      mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
      collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
      defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
      onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
      animatedefault: false, //Should contents open by default be animated into view?
      persiststate: true, //persist state of opened contents within browser session?
      toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
      togglehtml: ["suffix", "<img src='images/plus.png' class='statusicon' />", "<img src='images/minus.png' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
      animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
      oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
      //do nothing
      },
      onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
      //do nothing
      }
    }ddaccordion.init(initObj);//
    //就是这意思:当然,这个对象[ddaccordion]不是我定义的,如是我定义,绝对不会 这样搞初始化,(这样写的家伙,肯定没有学过代码优化的)