spring table 列表中点击选中的行获取点击时没有反应。

wenwen1 发布于 2012/12/06 15:12
阅读 425
收藏 0

我的jsp页面如下:

<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp"/>
<fmt:setBundle basename="bundles.projectprocure-resources"/>
<html>
<head>
<title>Manage <fmt:message key="projectprocure.title"/></title>
<meta name="decorator" content="iframe"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
//-------------------------------------列表排序------------------------------------
$(document).ready(function() {
    $("table").tablesorter({
        headers: {
           6: {
                sorter: false
            }
        }
    });
    //-------------------------------------结束------------------------------------
    function click(i){
     var j=i;
     alert(j);
    }
</script>
<style type="text/css">
table.tablesorter {
font-family:arial;
background-color: #CDCDCD;
margin:10px 0pt 15px;
font-size: 8pt;
width: 100%;
text-align: left;
float:left;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
background-color: #e6EEEE;
border: 1px solid #FFF;
font-size: 8pt;
padding: 4px;
}
table.tablesorter thead tr .header {
background-image: url(blueimages/bg.gif);
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
table.tablesorter tbody td {
color: #3D3D3D;
padding: 4px;
background-color: #FFF;
vertical-align: top;
}
table.tablesorter tbody tr.odd td {
background-color:#F0F0F6;
}
table.tablesorter thead tr .headerSortUp {
background-image: url(${pageContext.request.contextPath}/jquery/blueimages/asc.gif);
}
table.tablesorter thead tr .headerSortDown {
background-image: url(${pageContext.request.contextPath}/jquery/blueimages/desc.gif);
}
</style>
</head>
<body>
<div id="contentarea" >
 <div id="content">
 <!--项目采购列表 -->
 <div id="tablewrapper">
   <table cellpadding="0" cellspacing="0" id="listTable" class="tablesorter">
    <thead>
     <tr>
     <th  width="10%"><fmt:message key="projectprocureplan.procurecontent.title"/></th>
     <th  width="10%"><fmt:message key="projectprocureplan.amount.title"/></th>
     <th  width="10%"><fmt:message key="projectprocureplan.planprocuredate.title"/></th>
     <th  width="10%"><fmt:message key="projectprocureplan.supplierid.title"/></th>
     <th  width="10%"><fmt:message key="projectprocureplan.creater.title"/></th>
     <th  width="10%"><fmt:message key="projectprocureplan.memo.title"/></th>
     <th  width="8%"><fmt:message key="operation"/></th>
     </tr>
    </thead>
    <tbody>
     <c:forEach items="${projectprocureplans}" var="current"  varStatus="i"> 
      <c:choose>
       <c:when test="${(i.count) % 2 == 0}">
           <c:set var="rowclass" value="rowtwo"/>
       </c:when>
       <c:otherwise>
           <c:set var="rowclass" value="rowone"/>
       </c:otherwise>
      </c:choose>
     <tr class="${rowclass}">
      <td>
       ${current.procureContent}&nbsp;
      </td>
      <td>
       ${current.amount}&nbsp;
      </td>
      <td>
      <fmt:formatDate dateStyle="short" type="both" value="${current.planProcureDate.time}"/>
             &nbsp;
      </td>
      <td>
       ${current.supplier.supplierName}
      &nbsp;
      </td>
      <td>
      ${current.userByCreater.cname}
      &nbsp;
      </td>
      <td id="memo[i]">
      ${current.memo}
      &nbsp;
      </td>
      <td  nowrap="nowrap" class="tabletd">       
        <a title="<fmt:message key="navigation.edit" />" href="${pageContext.request.contextPath}/updateProcureApplication?idKey=${current.id}&" id="edit" onclick="click(i)"><img src="${pageContext.request.contextPath}/images/icons/edit.gif" /></a>        
        <a title="<fmt:message key="navigation.delete" />" href="${pageContext.request.contextPath}/deleteOldProcureApplication?id=${current.id}&" onclick='return confirm("<fmt:message key="confirm.if.delete"/>")'><img src="${pageContext.request.contextPath}/images/icons/delete.gif" /></a>
         &nbsp;
         </td>
     </tr>
     </c:forEach>
    </tbody>
   </table>
   <!--项目采购列表 -->
  </div>
 </div>
</div>
</body>
</html>

为什么我点击edit图片时没有弹出框提示啊?onclick那个函数根本不起作用啊.

加载中
0
xmut
xmut

不明白跟Spring有啥关系?Spring哪里得罪你了?一个浏览器也就HTML、CSS、javascript。

你可以这样试试:

<a href="javascript:click(i)">测试</a>

或者

<a href="http://XXXX.xxxx" onclick="click(i);return false;">测试</a> //加return false阻止超链接跳转

wenwen1
wenwen1
嗯,谢啦!
返回顶部
顶部