解决方案 »

  1.   

    指定ID,动态绑定事件
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
     <div class="position">
        <a href="#">首页</a> > 优惠管理 > 优惠查询
    </div> 
    <ul class="check" style="float: left;margin-left: 56px;margin-bottom: 10px">
        <li><b style="width: 80px">优惠类型:</b>
            <select id="couponType">
                <option value="-1" selected>请选择优惠类型</option>
                <c:forEach items="${couponTypes }" var="type">
                    <c:choose>
                        <c:when test="${type.key eq coupon.couponType}">
                            <option value="${type.key }" selected>${type.value }</option>
                        </c:when>
                        <c:otherwise>
                            <option value="${type.key }">${type.value }</option>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>
            </select>
        </li>
        <li><b>名称:</b><input type="text" id="couponName" value="${coupon.couponName }"/></li>
        <li><button onclick="doQryCoupon(this)">查询</button></li>
    </ul>
    <div class="check_list">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <thead>
                <tr>
                    <td>名称 </td>
                    <td>类别 </td>
                    <td>面值</td>
                    <td>开始时间</td>
                    <td>结束时间</td>
                    <td>使用范围</td>
                    <td>使用规则</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="${page.itemObj }" var="data" varStatus="status">
                    <tr id="item${status.index }">
                        <td>${data.couponName }</td>
                        <td>
                            <c:choose>
                                <c:when test="${data.couponType eq 'Favor'}">优惠券</c:when>
                                <c:when test="${data.couponType eq 'OneYuan'}">劲爆单品</c:when>
                            </c:choose>
                        </td>
                        <td>${data.couponPrice}</td>
                        <td>${data.couponBegin}</td>
                        <td>${data.couponEnd}</td>
                        <td>${data.couponScope}</td>
                        <td>${data.couponRule}</td>
                        <td><a href="javascript:toEditCoupon('${data.couponID}')">编辑</a> | <a class="del"  data-couponid="${data.couponID}" data-index="item${status.index }" href="#">删除</a></td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
    </div>
    <c:if test="${page.pageCount gt 1}">
        <div id="splitPage" data-name="优惠券信息" data-curPage="${page.curPage}" data-pageCount="${page.pageCount }"  style="float: right;margin-right: 56px;">
            <a href="javascript:goPage(-1)">上一页</a>
            <a href="javascript:goPage(1)">下一页</a>
        </div>
    </c:if><script>
    $('a.del').click(function(){
    var t=$(this);
    doModifyPwd(t.attr('data-couponid'),t.attr('data-index'));
    return false;
    })
    </script>
      

  2.   

    java在写 jswing的时候
    控件怎么和事件绑定的呢?
    可以参考下