全选checkbox 的写法
<input type="checkbox" id="chkAll"
οnclick='$(this).parents("table:first").find(":checkbox[:gt(0)]").attr("checked", this.checked)'/>
$(this) 当前元素
parents 父标签中的 table 标签 开始找 checkbox 标签
:gt(0) >0 从第二个开始找
.attr 属性为 checked ,
this.checked 把当前的checked 属性赋给它。
$(function() {
<s:if test="#request.success">
alert("<s:text name="label.action.tip.success" />");
window.location = '${ctx}/foobet/casino/member/classic/member!list.action';
</s:if>
$.each([ <s:property value="limit1" /> ], function(i, n) {
$("#chk_" + n).attr("checked", true);
});
});
$.each() 循环函数 limit1 (10,11,12)
id为 chk_10 的属性 checked 为true
$(this) js 对象转化为jquery对象用$()
jquery 对象转为js 对象
js 对象转为jquery对象 $("#gameselect")[0]
页面
<%@ page contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="../../../global/jasper/classic/TLDInclude.jsp"%>
<s:i18n name="foobet.casino.member.jasper.classic.memberI18n">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>co</title>
<%@ include file="../../../global/jasper/classic/meta.jsp"%>
<%@ include file="../../../global/jasper/classic/css.jsp"%>
<sj:head jqueryui="true" jquerytheme="flick" loadFromGoogle="false" />
<script type="text/javascript"
src="${ctx}/foobet/casino/global/bedeck/classic/js/table.js"></script>
</head>
<body>
<form action="${ctx}/foobet/casino/member/classic/member!save.action"
method="post" οnsubmit="return checkForm();">
<s:hidden name="memberid"></s:hidden>
<table width="100%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td height="30">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_03.gif"
width="15" height="30" />
</td>
<td width="1101"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_05.gif">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/001.gif"
width="16" height="16" />
<span class="STYLE4"><s:text name="label.memberinfodetail" />
</span>
</td>
<td width="281"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_05.gif">
</td>
<td width="14">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_07.gif"
width="14" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_12.gif">
</td>
<td bgcolor="#f3ffe3">
<table cellpadding="0" cellspacing="1" class="inputTb">
<tr>
<th width="15%">
<s:text name="label.memberinfo.title.acctid" />
:
</th>
<td width="35%">
<s:property value="acctid" />
</td>
<th width="15%">
<s:text name="label.memberinfo.title.membername" />
:
</th>
<td width="35%">
<s:textfield name="membername" />
</td>
</tr>
<tr>
<th width="15%">
<s:text name="label.memberinfo.title.password" />
:
</th>
<td width="35%">
<s:password name="password" />
</td>
<th width="15%">
<s:text name="label.memberinfo.title.tel" />
:
</th>
<td width="35%">
<s:textfield name="tel" />
</td>
</tr>
<tr>
<th width="15%">
<s:text name="label.memberinfo.title.password.confirm" />
:
</th>
<td width="35%">
<input type="password" id="pwdConfirm" />
</td>
<th width="15%">
<s:text name="label.memberinfo.title.email" />
:
</th>
<td width="35%">
<s:textfield name="email" />
</td>
</tr>
</table>
</td>
<td width="9"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_16.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_03.gif"
width="15" height="30" />
</td>
<td width="1101"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_05.gif">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/001.gif"
width="16" height="16" />
<span class="STYLE4"><s:text name="label.betdetail" />
</span>
</td>
<td width="281"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_05.gif">
</td>
<td width="14">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_07.gif"
width="14" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_12.gif">
</td>
<td bgcolor="#f3ffe3">
<table cellpadding="0" cellspacing="1" class="inputTb">
<tr>
<th width="15%">
<s:text name="label.memberinfo.title.credit" />
:
</th>
<td width="35%">
<s:textfield name="remaincredit" />
()
</td>
<th width="15%" >
<s:text name="label.memberinfoinput.allow" />
:
</th>
<td width="35%">
<input type="checkbox" name="right" id="right" value="2" <s:property value="#request.map.add"/> <s:property value="#request.map.adddisable"/> >
<span>
<s:text name="label.memberinfoinput.add"></s:text>
</span>
<input type="checkbox" name="right1" id="right1" value="3" <s:property value="#request.map.modify"/> <s:property value="#request.map.modifydisable"/>>
<span>
<s:text name="label.memberinfoinput.modify"></s:text>
</span>
<input type="checkbox" name="right2" id="right2" value="4" checked disabled >
<span>
<s:text name="label.memberinfoinput.view"></s:text>
</span>
</td>
</tr>
<tr>
<th width="15%">
<s:text name="label.memberinfoinput.gameselect" />
:
</th>
<td width="35%">
<input type="checkbox" name="gameselect" id="gameselect" value="1" <s:property value="#request.map.selectGamedisable"/> >
<span>
<s:text name="label.memberinfo.field.baccarat"></s:text>
</span>
</td>
<th width="15%">
<s:text name="label.memberinfo.field.baccarat" />
<s:text name="label.memberinfoinput.sharing" />
:
</th>
<td width="35%">
<s:textfield name="possessionp1" />
</td>
</tr>
<tr>
<th width="15%">
<s:text name="label.memberinfo.field.baccarat" />
<s:text name="label.memberinfoinput.commission" />
:
</th>
<td width="35%">
<s:textfield name="turnoverp1" />
</td>
<th width="15%" />
<td width="35%" />
</tr>
</table>
</td>
<td width="9"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_16.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="30">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_03.gif"
width="15" height="30" />
</td>
<td width="1101"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_05.gif">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/001.gif"
width="16" height="16" />
<span class="STYLE4"><s:text name="label.memberinfo.field.baccarat" />
<s:text name="label.memberinfoinput.limit" />
</span>
</td>
<td width="281"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_05.gif">
</td>
<td width="14">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_07.gif"
width="14" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_12.gif">
</td>
<td bgcolor="#f3ffe3">
<table style="margin-top: 2px;" class="resultTb" cellpadding="0" cellspacing="1" >
<tr>
<th>
<input type="checkbox" id="chkAll"
οnclick='$(this).parents("table:first").find(":checkbox[:gt(0)]").attr("checked", this.checked)'/>
</th>
<th>
<s:text name="label.memberinfo.title.all" />
</th>
<th>
<s:text name="label.memberinfo.title.banker" />
<s:text name="label.memberinfo.title.player" />
</th>
<th>
<s:text name="label.memberinfo.title.tie" />
</th>
<th>
<s:text name="label.memberinfo.title.pair" />
</th>
<th>
<s:text name="label.memberinfo.title.big" />
</th>
<th>
<s:text name="label.memberinfo.title.small" />
</th>
</tr>
<s:iterator status="status" value="#request.lhjList" id="item">
<tr>
<td align="center">
<input type="checkbox" name="limit1" value="<s:property value='id'/>" id="chk_<s:property value='id'/>"/>
</td>
<td>
<s:property value='all'/>
</td>
<td>
<s:property value="bankerPlayer"/>
</td>
<td>
<s:property value="tie"/>
</td>
<td>
<s:property value="pair"/>
</td>
<td>
<s:property value="big"/>
</td>
<td>
<s:property value="small"/>
</td>
</tr>
</s:iterator>
</table>
<p align="center">
<input type="submit" class="btn1"
value="<s:text name="label.commit"/>" />
<input type="reset" class="btn1"
value="<s:text name="label.reset"/>" />
</p>
</td>
<td width="9"
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_16.gif">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="15">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_20.gif"
width="15" />
</td>
<td
background="${ctx}/foobet/casino/global/bedeck/classic/images/tab_21.gif">
</td>
<td width="14">
<img
src="${ctx}/foobet/casino/global/bedeck/classic/images/tab_22.gif"
width="14" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
<script>
$(function() {
<s:if test="#request.success">
alert("<s:text name="label.action.tip.success" />");
window.location = '${ctx}/foobet/casino/member/classic/member!list.action';
</s:if>
$.each([ <s:property value="limit1" /> ], function(i, n) {
$("#chk_" + n).attr("checked", true);
});
});
// 校验表单内容是否合法
function checkForm() {
// 验证email格式
var emailreg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
if (!emailreg.test($("#email").val())) {
alert("<s:text name="label.memberinfo.title.email" /><s:text name="label.format.incorrect" />");
$("#email").focus();
return false;
}
// password
if ($("#password").val() != $("#pwdConfirm").val()) {
alert("<s:text name="label.memberinfo.checkform.password.confirm" />");
$("#password").focus();
return false;
}
return true;
}
</script>
</s:i18n>