<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<html>
<head>
<title>用户信息</title>
<script type="text/javascript">
function isDate(str){
var reg = /^(\d{4})\-(\d{2})\-(\d{2})$/ ;
if (reg.test(str)){
return true;
}
else {
return false;
}
}
function checkEmail(email) {
var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (reg.test(email)) return true;
else {
alert('您的电子邮件格式不正确');
return false;
}
}
function checkMobile(mobile){
var reg = /^\\(?\\d{3,4}[-\\)]?\\d{7,8}$/
if(reg.test(mobile))return true;
else {
alert("你的电话号码格式不正确");
return false;
}
}
function checkAll(){
with(document.all){
if (!isDate(document.getElementById("regTiem").value)){
alert("请输入正确的日期格式!例如:2000-01-01!");
txtEndDate.focus();
return false;
}
/*if(!checkEmail(document.getElementById("email").value)){
alert("请输入正确的邮件格式!例如:***@**.com");
return false;
}
if(!checkMobile(document.getElementById("mobile").value)){
alert("请输入正确的号码格式");
return false;
}*/
}
}
</script>
</head>
<body>
<s:form action="userAction!editUser.action">
<input type="hidden" value="add"/>
<input type="hidden" name="action" value='<s:property value="action"/>'/>
<s:property value="message"/><br>
<!-- <s:if test="user.userId != null">
<s:property value="user.userId"/>,<s:property value="user.userName"/>,
<s:property value="user.regTiem"/>,<s:property value="user.gender"/>,
<s:property value="user.state"/>,<s:property value="user.password"/>,
<s:property value="user.mobile"/>,<s:property value="user.email"/>,
<s:property value="#request.myname"/>,<s:property value="#session.mysex"/>
</s:if>-->
<br>
<table>
<tr>
<td>
<s:hidden name="user.userId"/>
<s:textfield label="姓名" name="user.userName"/>
</td>
</tr>
<tr>
<td>
<s:textfield label="密码" name="user.password" />
</td>
</tr>
<tr>
<td>
<s:textfield id="regTiem" label="出生日期" name="user.regTiem" />
</td>
</tr>
<tr>
<td>
<s:select label="性别" name="user.gender" list="#{ 1:'男', 2: '女', 3: '未知'}" listKey="key" listValue="value">
</s:select>
</td>
</tr>
<tr>
<td>
<s:textfield label="地址" name="user.state"/>
</td>
</tr>
<tr>
<td>
<s:textfield label="电话" id="mobile" name="user.mobile"/>
</td>
</tr>
<tr>
<td>
<s:textfield label="邮箱" id="email" name="user.email" />
</td>
</tr>
<tr>
<td align="right">
<s:submit vlaue="保存" onClick="checkAll()"/>
</td>
</tr>
</table>
</s:form>
<br>
<a href="${pageContext.request.contextPath}">返回主页</a><br>
<s:a href="userAction!userList.action">返回显示</s:a>
</body>
</html>
分享到:
相关推荐
function checkAll(boolvalue){ var items=document.getElementsByTagName("input"); for(i=0;i;i++){ if(items[i].type=="checkbox"){ items[i].checked=boolvalue; } } } //反选 function IscheckAll...
function CheckAll(form)根据name=chkAll的checkBox的选中与否来设置其它checkBox全选与全不选,并激活一个事件来验证表单 function UnselectAll(form)取消选择 function ExportXML(checkboxName)导出xml模板文件 ...
function checkAll() { for (var j = 1; j ; j++) { var box = eval("document.checkboxform.C" + j); if (box.checked == false) { box.checked = true; } } } function uncheckAll() { for (var j = 1;...
function checkall() { var ischecked = document.getElementById("checkall").checked; if(ischecked) { checkallbox(); } else { discheckallbox(); } } ``` 点击“全选/全不选”复选框,如果选中,则选中...
function checkAll(name) { var el = document.getElementsByTagName('input'); var len = el.length; for (var i = 0; i ; i++) { if ((el[i].type == "checkbox") && (el[i].name == name)) { el[i].checked ...
function checkAll() { $('input[name="TheID"]').prop("checked", true); } ``` - **解析**:使用jQuery的选择器`$('input[name="TheID"]')`来选择所有名为`TheID`的Checkbox,然后使用`prop()`方法设置它们的`...
function checkAll(theForm, cName, status) { for (var i = 0, n = theForm.elements.length; i ; i++) { if (theForm.elements[i].className.indexOf(cName) != -1) { theForm.elements[i].checked = status; ...
function checkAll() { $(":checkbox").attr("checked", true); } ``` 上述代码通过jQuery的选择器`$(":checkbox")`选中页面上所有的复选框,并通过`attr("checked", true)`设置它们的`checked`属性为`true`,从而...
function checkAll(chkAllID, thisObj) { var chkAll = document.getElementById(chkAllID); var chks = document.getElementsByTagName("input"); var chkNo = 0; var selectNo = 0; for (var i = 0; i ; i++...
function checkAll() { form = document.forms[0]; var opt = form.checkme; delAll(); for (var i = 0; i ; i++) { addAll(opt[i]); opt[i].checked = true; } } ``` - **全不选功能**: ```javascript...
function checkAll(form, status) { var checkboxes = form.querySelectorAll('input[type="checkbox"]'); for (var i = 0; i ; i++) { checkboxes[i].checked = status; // status为true时全选,为false时取消...
function checkAll(e, itemName) { var aa = document.getElementsByName(itemName); // 获取所有相关的复选框 for (var i = 0; i ; i++) { aa[i].checked = e.checked; // 设置所有相关复选框的状态与“全选”复...
function checkAll(boolValue) { var allCheckBoxs = document.getElementsByName("isBuy"); for (var i = 0; i ; i++) { if (allCheckBoxs[i].type == "checkbox") { allCheckBoxs[i].checked = boolValue; } ...
name="check">选项2 <input type="checkbox" name="check">选项3 <script>function checkAll(source){ var checkboxes = document.getElementsByName('check'); for(var i=0;i;i++){ checkboxes[i].checked = ...
function checkAll(boolValue) { var allCheckBoxs = document.getElementsByName("isBuy"); for (var i = 0; i ; i++) { if (allCheckBoxs[i].type == "checkbox") { allCheckBoxs[i].checked = boolValue; } ...
function checkAll() { var allCheckbox = document.getElementById("isAll"); var itemCheckboxes = document.getElementsByName("items"); for (var i = 0; i ; i++) { itemCheckboxes[i].checked = all...
function checkAll() { var code_Values = document.all['code_Value']; if (code_Values.length) { // 检查是否有多个元素 for (var i = 0; i ; i++) { code_Values[i].checked = true; // 将每个复选框设置为...
function checkAll(str) { var a = document.getElementsByName(str); var n = a.length; for (var i = 0; i ; i++) { a[i].checked = true; } } ``` - **功能**: 使具有相同名称的所有复选框被选中。 - **参数...