0

削除ボタンをクリックすると、取得CustomerIDしてアクションに送信します。関数の削除を実行します。

<display:table name="sessionScope.CustomerForm.customers" id="row"
        requestURI="/Customer.do" pagesize="15" style="text-align:center"
        excludedParams="_chk" clearStatus="true">
    <display:column title="checkkbox">
        <input type="checkbox" onclick="selectCheckbox();" id="checkBox" />
    </display:column>
    <display:column style="width:500px" property="customerID"
            title="Customer ID" sortable="true" paramId="customerID"
            href="Edit.do">
    </display:column>
    <display:column style="width:300px" property="customerName"
            title="Customer Name" sortable="true" />
    <display:column style="width:300px" property="sex" title="Sex"
            sortable="true" />
    <display:column style="width:300px" property="birthday"
            title="Birthday" sortable="true" />
    <display:column style="width:300px" property="email" title="Email"
            sortable="true" />
    <display:column style="width:300px" property="address"
            title="Address" sortable="true" />
</display:table>
</div>
<br>
<div>
    <html:button styleClass="submit" property="Add new" value="Add New"></html:button>
    <html:button styleClass="submit" property="Delete" value="Delete" ></html:button>
</div>
</html:form>
4

1 に答える 1

0

次のように、customerID パラメーターを js 関数に渡します。

<display:column title="checkkbox">
        <input type="checkbox" onclick="selectCheckbox(<bean:write value="customerID" />);" id="checkBox" />
    </display:column>

また

js 関数に渡しthis、js または jQuery を使用して html コードをナビゲートします。たとえば、次のようなものを使用できます。

    function selectCheckbox(element){
             var customerID = $(element).parent().children("td")[1].html();
             // do your stuff!
}
于 2014-10-20T10:15:25.160 に答える