问题是这样的,看代码
   for(var i=0;i<data.rows.length;i++){
             html+="<ul class='ullist'><li class='lilist'>" +
                        "<a style='cursor:pointer' onclick=noticeList("+data.rows[i]")
                       +<span style='font-size:12; color:#F00'>new</span></li></ul>" ;//data.rows[i].id 是有值的
              }function noticeList(data){
  alert(data.id)
}
 现在这个alert(data.id)不出来,说少了个"] " 
 很是郁闷,请Js高手帮帮忙.. 

解决方案 »

  1.   

     "<a style='cursor:pointer' onclick=noticeList("+data.rows[i]")
    改成 "<a style='cursor:pointer' onclick=noticeList("+data.rows[i] + ")
    少了个+号吧
      

  2.   

     html+="<ul class='ullist'><li class='lilist'>" +
      "<a style='cursor:pointer' onclick=noticeList("+data.rows[i] +")
      <span style='font-size:12; color:#F00'>new</span></li></ul>" ;
      

  3.   

     我的意思就是在
    function noticeList(data){
      alert(data.id)
    }
    方法里面怎样获取data.id的值。
      

  4.   

     for(var i=0;i<data.rows.length;i++){
      html+="<ul class='ullist'><li class='lilist'>" +
      "<a style='cursor:pointer' onclick=noticeList("+data.rows[i]")
      +<span style='font-size:12; color:#F00'>new</span></li></ul>" ;//data.rows[i].id 是有值的
      }在这里面我弹一个alert(data.rows(i));
     值为[object object]
      

  5.   

    jQuery(document).ready(function(){
             MyAjax.easyPost("pems/indexmanager/notebook/loadPerformaceListByIndex.do", {}, function(data) {
                 var html="";
                 var xx=$("#loadPerform");
                if(data.rows.length>0){
                for(var i=0;i<data.rows.length;i++){
                  html+="<ul class='ullist'><li class='lilist'>" +
                             "<a style='cursor:pointer' onclick=performanList("+data.rows[i].id+",'"+data.rows[i].symbol+"','"+data.rows[i].content+"','"+data.rows[i].title+"')>"+data.rows[i].title+"</a>" +
                            "<span style='font-size:12; color:#F00'>new</span></li></ul>" ;
                  }
                     xx.html(html);
                    if(data.records>6){
                       xx.append("<ul class='ullist'><li class='lilist'><a  style='cursor:pointer;' onmouseover='this.className=\"ahover\"' onmouseout='this.className=\"over\"' onclick=nextPagePrc("+data.page+")><<</a> " +
                      "<a style='cursor:pointer;margin-left:360px' onmouseover='this.className=\"ahover\"' onmouseout='this.className=\"over\"' onclick=onPagePrc("+data.page+")>>></a></li></ul>");
                    }             }
                },null,null);
    )};function  noticeList(data){
          var r= ("pems/indexmanager/notebook/notice_list.jsp?id="+data.id+"&title="+data.title+"&content="+data.content+"&startTime="+data.startTime+"&endTime="+data.endTime);
         var b=encodeURI(r);
         var c=encodeURI(b);
         jQuery.FrameDialog
                .create({
            url: c,
            title: '公告明细',
            width:550,
            height:340,
            buttons:{
                '确定':function() {
                    $(this).dialog("close");
                },
                '取消':function() {
                    $(this).dialog("close");
                }
            }
        }) }
      

  6.   

    data.rows[i] 是对象, html+= 所做的是字符串拼接 ,字符串和 对象拼接显然不对,
    要么 就直接 取 id :
    ... onclick='noticeList(\"" + data.rows[i].id + "\");' > ..."function noticeList(sID){
      alert(sID)
    }
      

  7.   

        我之前是这样写的,可是后来我的data.rows[i].id中有空格,就不行啊 ,就报一个未结束的字符串常量,所以我就想到了传一个对象,到function noticeList()方法里来取值。