首页 新闻 会员 周边

在jsp页面应用了FlexiGrid表格插件,JavaScript对类为“modify”绑定的事件无响应了,怎么破?

0
悬赏园豆:50 [待解决问题]

哪位大神能说说是啥情况?卡壳好几天了

显示按钮如下,修改按钮的class为“modify”

JSP源码如下

  1 <table class="flexme1">
  2                                 <thead>
  3                                 <tr>
  4                                     <th width="60">操作</th>
  5                                     <th width="80">户名</th>
  6                                     <th width="100">用户编号</th>
  7                                     <th width="100">表计名称</th>
  8                                     <th width="100">表计编号</th>
  9                                     <th width="50">累计用量</th>
 10                                     <th width="30">倍率</th>
 11                                     <th width="40">开关阀</th>
 12                                     <th width="100">集中器地址</th>
 13                                     <th width="30">序号</th>
 14                                     <th width="50">表计状态</th>
 15                                     <th width="50">用户大类</th>
 16                                     <th width="50">通信速率</th>
 17                                     <th width="50">端口</th>
 18                                     <th width="80">表身码</th>
 19                                     <th width="350">表安装安置</th>
 20                                 </tr>
 21                                 </thead>
 22                                 <tbody>
 23                                     <c:forEach items="${pageList}" var="cInfo" varStatus="loop">
 24                                     <tr>
 25                                         <td>
 26                                             <c:if test="${pv:validate(userPermissions,'0205','03')}">
 27                                                 <img src="../images/icon/edit.png" style="cursor: pointer;"
 28                                                     class="modify" width="16" height="16" alt="save" title="修改" />
 29                                             </c:if> 
 30                                             <c:if test="${pv:validate(userPermissions,'0205','04')}">
 31                                                 <img src="../images/icon/delete.png" style="cursor: pointer;"
 32                                                     class="delete" width="16" height="16" alt="delete" title="删除" />
 33                                             </c:if>
 34                                             <c:if test="${pv:validate(userPermissions,'0205','04')}">
 35                                                 <img src="../images/icon/cog.png" style="cursor: pointer;"
 36                                                     class="set" width="16" height="16" alt="set" title="设置" />
 37                                             </c:if>
 38                                         </td>                           
 39                                         <td>${cInfo.userName}</td>
 40                                         <td>${cInfo.houseHoldId}</td>
 41                                         <td>${cInfo.meterName}</td>
 42                                         <td><a href="${AppPath}/monitor/meterMonitor.do?command=query&meterCode=${cInfo.meterCode}" >${cInfo.meterCode}</a></td>
 43                                         <%-- 
 44                                         <td>${cInfo.meterCode}</td>
 45                                          --%>
 46                                         <td>${cInfo.lastestDegree}</td>
 47                                         <td>${cInfo.PT}</td>
 48                                         <td>
 49                                             <c:if test="${cInfo.valvesState==1}">开阀</c:if>
 50                                             <c:if test="${cInfo.valvesState==0}">关阀</c:if>
 51                                         </td>
 52                                         <td>${cInfo.crAddress}</td>
 53                                         <td>${cInfo.seq}</td>
 54                                         <td>
 55                                             <c:if test="${cInfo.status==0}">初始化</c:if>                                        
 56                                             <c:if test="${cInfo.status==1}">正常</c:if>
 57                                             <c:if test="${cInfo.status==2}">异常</c:if>
 58                                             <c:if test="${cInfo.status==3}">断电拉闸</c:if>
 59                                         </td>
 60                                         <td>
 61                                             <c:if test="${cInfo.bigType==0}">冷水表</c:if>
 62                                             <c:if test="${cInfo.bigType==1}">中水表</c:if>                                       
 63                                         </td>
 64                                         <td>
 65                                             <c:if test="${cInfo.bps==0}">默认</c:if>
 66                                             <c:if test="${cInfo.bps==1}">600</c:if>
 67                                             <c:if test="${cInfo.bps==2}">1200</c:if>
 68                                             <c:if test="${cInfo.bps==3}">2400</c:if>
 69                                             <c:if test="${cInfo.bps==4}">4800</c:if>
 70                                             <c:if test="${cInfo.bps==5}">7200</c:if>
 71                                             <c:if test="${cInfo.bps==6}">9600</c:if>
 72                                             <c:if test="${cInfo.bps==7}">19200</c:if>                                           
 73                                         </td>
 74                                         <td>
 75                                             <c:if test="${cInfo.port==1}">MBUS1</c:if>
 76                                             <c:if test="${cInfo.port==2}">MBUS2</c:if>
 77                                             <c:if test="${cInfo.port==3}">MBUS3</c:if>
 78                                             <c:if test="${cInfo.port==4}">MBUS4</c:if>                                          
 79                                         </td>
 80 
 81                                         <td>${cInfo.virAddress}</td>
 82                                         <td>${accountAddressMap[cInfo.accountCode]}</td>
 83                                     </tr>
 84 
 85                                     </c:forEach>
 86                                 </tbody>
 87                 </table>
 88 
 89 
 90 
 91 <div class="msgbox1 pz1" id="draggable" style="display:none;">
 92 <div class="menu">
 93     <span> <a href="#" onclick="$('#draggable').fadeOut('slow');return false;" style="cursor: pointer;">关闭窗口</a> </span>
 94     <h1>详细信息</h1>
 95 </div>
 96 <ul class="infobox">
 97     <li><span>表计编码:</span>
 98     <input type="hidden" id="Detail_status" value="0" />
 99     <input id="Detail_meterCode" type="text" size="25" maxlength="20" class="input1" value="" /> 
100     <label class="Red" title="必填项">*</label>
101     <label id="feedback_meterCode"></label>
102     </li>
103     <li><span>表计名称:</span>
104     <input id="Detail_meterName" type="text" size="25" maxlength="20" class="input1" value="" />
105     <label class="Red">*</label>
106     <label id="feedback_meterName"></label>
107     </li>
108     <li><span>集中器地址:</span> 
109     <input id="Detail_crAddress" type="hidden" size="15" maxlength="12" class="input1" value="" />
110     <input id="Detail_crAddressDesc" type="text" size="27" maxlength="12" class="input1" value="" readonly="readonly"/>
111     <label class="Red">*</label>
112     <label id="feedback_crAddress"></label>
113     </li>
114     </li>
115     <li><span>户名:</span> 
116     <input id="Detail_userName" type="text" size="27" maxlength="12" class="input1" value="" />
117     <label id="feedback_userName"></label>
118     </li>   
119     <li><span>生产厂家:</span>
120     <input id="Detail_factoryId" type="hidden" class="input1" />
121     <input id="Detail_factoryDesc" type="text" size="25" maxlength="20" class="input1" readonly="readonly" />
122     <label class="Red">*</label>
123     <label id="feedback_factoryId"></label>
124     </li>
125     <li id="location"><span>所在房间:</span>
126     <input id="Detail_accountCode" type="hidden" class="input1" />
127     <input id="Detail_locationCodeDesc" type="text" size="25" maxlength="20" class="input1" value="" readonly="readonly" />
128     <label class="Red">*</label>
129     <label id="feedback_location"></label>
130     </li>
131 
132     <li class="bot">
133     <input type="hidden" id="Detail_Id" value="" /> 
134     <label class="pad_zy10"><input type="button" id="save" class="xiugai1"/></label>
135     <label class="pad_zy10"><input type="button" id="quxiao" class="quxiao1"  onclick="$('#draggable').fadeOut('slow');return false;" /></label></li>
136 </ul>
137     <div class="clear"></div>
138 </div>

 

 

JavaScript代码如下

 

  1 function showDetailWindow(obj){
  2     alert('123');
  3     if (obj.id == null){
  4         obj = this;
  5     }
  6     $("#draggable label[id^='feedback_']").attr("innerHTML","");
  7     $("#save").removeClass().addClass("xiugai1");
  8     var id = $(obj).parents("ul:first").attr("id").replace("TR","");
  9     loadInfo(id);
 10     $("#draggable").fadeIn("slow");
 11 }
 12 
 13 /**
 14  * 加载详细信息
 15  */
 16 function loadInfo(id){
 17 
 18 
 19     $("#Detail_crAddressDesc").attr("disabled","disabled");
 20     var items = ["status","meterCode","meterName","userName","crAddressDesc","factoryDesc","locationCodeDesc","locationNmae",
 21                         "locationNmae","virAddress","lineCode","crAddress","factoryId","accountCode","type","relay","boxCode","rateVolt","rateCurr",
 22                        "CT","PT","collector","lineType","level","parentCode",
 23                        "typeK","typeH","typeF","typeS","typeG","measupe",
 24                        "protocol","rate","gauge","model","energyItem","energyAttribute",
 25                        "seq","isTotal","crCode","smallType","bigType","port","bps"];
 26 
 27     $.ajax({
 28         type : 'POST',
 29         url  : 'meter.do',
 30         data : {
 31             command : "detail",
 32             meterId : id
 33         },
 34         dataType  : "json",
 35         cache : false,
 36         timeout  : 30000,
 37         success: function(msg){
 38             if (msg.meter){
 39                 $("#Detail_Id").attr("value", id);
 40                 for(var i=0;i<items.length;i++){
 41                     $("#Detail_"+items[i]).attr("value", msg.meter[items[i]]);
 42                 }
 43                 $("#Detail_crAddressDesc").attr("value",msg.crAddressDesc);             
 44                 $("#Detail_locationCodeDesc").attr("value", msg.locationCodeDesc);
 45                 $("#Detail_factoryDesc").attr("value",msg.factoryDesc);
 46                 $("#Detail_houseHoldId").attr("value",msg.houseHoldId);
 47                 $("#Detail_userName").attr("value",msg.userName);
 48                 $("#Detail_virAddress").attr("value",msg.virAddress);
 49                 $("#draggable").fadeIn("slow");
 50             }
 51         },
 52         error : function(){
 53             //$("#feedback").attr("innerHTML","<strong>"+ajaxfeedback_exception+"</strong>");
 54            // $("#feedback").removeClass().addClass("Red").fadeIn("slow");
 55               showFeedback(ajaxfeedback_exception);
 56         }
 57     });
 58 }
 59 
 60 /**
 61  * 保存信息
 62  */
 63 function save(){
 64     $("#Detail_lineCode").val("2");
 65      if($("#Detail_status").val()==""||$("#Detail_status").val()==null){
 66            $("#Detail_status").val("0");
 67        }
 68     var flag = validate();
 69     if (flag == false){
 70         return ;
 71     }
 72     var items=["status","meterCode","meterName","crAddress","userName","PT","factoryId","accountCode","locationNmae",
 73                "virAddress","lineCode","type","relay","boxCode","rateVolt","rateCurr",
 74                "CT","PT","collector","lineType","level","parentCode",
 75                "typeK","typeH","typeF","typeS","typeG","measupe",
 76                "protocol","rate","gauge","model","energyItem","energyAttribute",
 77                "seq","isTotal","crCode","smallType","bigType","port","bps"];
 78     var data={
 79              command : "saveOrUpdate",
 80              meterId : $.trim($("#Detail_Id").attr("value")),
 81              energyType : $.trim($("#type").attr("value")),
 82              houseHoldId :$.trim($("#Detail_houseHoldId").attr("value")),
 83              virAddress : $.trim($("#Detail_virAddress").attr("value"))
 84     };
 85     for(var i=0;i<items.length;i++){
 86         data[items[i]]=$.trim($("#Detail_"+items[i]).attr("value"));
 87     }
 88     $.ajax({
 89         type : 'POST',
 90         url  : 'meter.do',
 91         data : data,
 92         dataType  : "json",
 93         cache : false,
 94         timeout  : 30000,
 95         success: function(msg){
 96             if (msg.status){
 97                 $("#draggable").fadeOut("slow");
 98                 //$("#feedback").attr("innerHTML",msg.msg);
 99               // jump();  
100                 showFeedback(msg.msg,true);
101                 //$("#feedback").addClass("Blue").fadeIn("slow").fadeOut("slow");
102                 //$("[id^='feedback_']").removeClass().attr("innerHTML", "");
103 
104             }else{
105                 //服务器端验证失败或者异常反馈信息
106                 if ($.trim(msg.msg)!= ""){
107                     //单个信息失败
108                    // $("#feedback").removeClass().addClass("Red").attr("innerHTML",msg.msg.replaceAll("\\\|","<br/>")).fadeIn("slow");
109 
110                     showFeedback(msg.msg.replaceAll("\\\|","<br/>"));
111                     $("#draggable label[id^='feedback_']").removeClass().attr("innerHTML", "");
112                 }
113             }
114         },
115         error : function(){
116             //$("#feedback").attr("innerHTML","<strong>"+ajaxfeedback_exception+"</strong>");
117             //$("#feedback").removeClass().addClass("Red").fadeIn("slow");
118               showFeedback(ajaxfeedback_exception);
119         }
120     });
121 }
122 
123 
124  $(document).ready(function(){
125 
126     $(".modify").bind("click", showDetailWindow);
127     $(".delete").bind("click", delInfo);
128     $("#save").bind("click", save);
129 });

 

李序锴的主页 李序锴 | 初学一级 | 园豆:67
提问于:2017-02-28 16:23
< >
分享
所有回答(1)
0

浏览器、F12。找出对应js。步步排查

Ctrl` | 园豆:3317 (老鸟四级) | 2017-02-28 16:34

对应js我是知道的,现在的情况是点了修改、删除那几个按钮没反应,你觉得会是哪些原因?

支持(0) 反对(0) 李序锴 | 园豆:67 (初学一级) | 2017-03-01 14:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册