<td rowspan="2"> 合并两列
<form name="myform" method="post" action="chkregister.jsp" OnSubmit="return checkdata();">
function checkdata()
{
username=document.myform.username.value;
password1=document.myform.password1.value;
password2=document.myform.password2.value;
age=document.myform.age.value;
email=document.myform.email.value;
phone=document.myform.phone.value;
address=document.myform.address.value;
if(username.length<1||username.length>20)
{
alert("用户名长度必须在1位到20位之间");
return false;
}
if(password1.length<6||password1.length>10)
{
alert("密码长度必须在6位到10位之间");
return false;
}
if(password1!=password2)
{
alert("密码不匹配");
return false;
}
if(email==""||(email.indexOf('@')==-1)||(email.indexOf('.')==-1))
{
alert("电子邮件填写不正确");
return false;
}
if(age==""||isNaN(age)||parseInt(age)<0||parseInt(age)>99)
{
alert("年龄不合要求");
return false;
}
if(phone==""||isNaN(phone)||parseInt(phone)<0)
{
alert("电话号码不合规范");
return false;
}
if(address=="")
{
alert("地址不能为空");
return false;
}
return true;
}
<select name="face" size=1 onChange="document.images['face'].src=options[selectedIndex].value;">
<%
for (int i=1;i<=60;i++)
out.println("<option value=images/face/Image" + i + ".gif>Image"+ i +"</option>");
%>
</select>
[color=red]日期格式化[/color]
java.text.DateFormat df = java.text.DateFormat.getDateInstance(DateFormat.MEDIUM, request.getLocale());
df.format(new java.util.Date())
<form name="myform" method="post" action="chkregister.jsp" OnSubmit="return checkdata();">
function checkdata()
{
username=document.myform.username.value;
password1=document.myform.password1.value;
password2=document.myform.password2.value;
age=document.myform.age.value;
email=document.myform.email.value;
phone=document.myform.phone.value;
address=document.myform.address.value;
if(username.length<1||username.length>20)
{
alert("用户名长度必须在1位到20位之间");
return false;
}
if(password1.length<6||password1.length>10)
{
alert("密码长度必须在6位到10位之间");
return false;
}
if(password1!=password2)
{
alert("密码不匹配");
return false;
}
if(email==""||(email.indexOf('@')==-1)||(email.indexOf('.')==-1))
{
alert("电子邮件填写不正确");
return false;
}
if(age==""||isNaN(age)||parseInt(age)<0||parseInt(age)>99)
{
alert("年龄不合要求");
return false;
}
if(phone==""||isNaN(phone)||parseInt(phone)<0)
{
alert("电话号码不合规范");
return false;
}
if(address=="")
{
alert("地址不能为空");
return false;
}
return true;
}
<select name="face" size=1 onChange="document.images['face'].src=options[selectedIndex].value;">
<%
for (int i=1;i<=60;i++)
out.println("<option value=images/face/Image" + i + ".gif>Image"+ i +"</option>");
%>
</select>
[color=red]日期格式化[/color]
java.text.DateFormat df = java.text.DateFormat.getDateInstance(DateFormat.MEDIUM, request.getLocale());
df.format(new java.util.Date())