<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="css/common.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/clock.js"></script>
<script type="text/javascript" src="js/display.js"></script>
<script language="javascript">
//验证用户名
function checkAll()
{
if(checkMZ()&&checkPhone()&&checkLove())
{
return true;
}
return false;
}
function checkUName()
{
var UName=document.getElementById("uname");
if(UName.value=="")
{
alert("用户名不能为空!");
return false;
}
else
{
var zz=/^[a-zA-Z][a-zA-Z0-9_]{2,19}$/;
if(!zz.test(UName.value))
{
alert("您输入的用户名不符合规范!请重新输入");
UName.focus();
UName.select();
return false;
}
}
return true;
}
function checkSex()
{
var sexs=document.getElementsByName("sex");
var bsex=false;
for(var i=0;i<sexs.length;i++)
{
if(sexs[i].checked)
{
bsex=true;
break;
}
}
if(!bsex)
{
alert("性别不能为空!");
return false;
}
}
//控制民族div的显示与隐藏
function show()
{
var divdisplay=document.getElementById("jg");
divdisplay.style.display="";
//设置div的左边距和上边距
divdisplay.style.pixelTop=window.event.clientY;
divdisplay.style.pixelLeft=window.event.clientX+50;
}
//为民族赋值
function setValue()
{
var divValue=document.getElementsByName("jg1");
var changess=false;
var jgValue="";
for(var i=0;i<divValue.length;i++)
{
if(divValue[i].checked)
{
changess=true;
jgValue=divValue[i].value;
break;
}
}
if(!changess)
{
alert("请选择民族!");
return false;
}
else
{
//将选择的民族赋给文本框
document.getElementById("mz").value=jgValue;
//确定输入以后就将层隐藏
var divdisplay=document.getElementById("jg");
divdisplay.style.display="none";
}
}
//验证民族是否为空
function checkMZ()
{
var MZ=document.getElementById("mz");
if(MZ.value=="")
{
alert("民族不能为空!");
return false;
}
return true;
}
function checkArea()
{
var Area=document.getElementById("dlarea");
if(Area.value=="请选择")
{
alert("请选择省份");
return false;
}
return true;
}
//省级联会
function checkCity()
{
var cityList=new Array();
cityList['湖北省']=['武汉','荆州','襄樊','恩施'];
cityList['湖南省']=['长沙','常德','张家界','华容'];
var index=document.getElementById("dlarea").value;
var newoptions;
document.getElementById("dlcity").options.length=0;
for(var i in cityList[index])
{
newoptions=new Option(cityList[index][i],cityList[index][i]);
document.getElementById("dlcity").options.add(newoptions);
}
}
//验证联系方式
function checkPhone()
{
var Mobile=document.getElementById("mobile");
var Telephone=document.getElementById("telephone");
if(Mobile.value==""&&Telephone.value=="")
{
alert("请任选一种联系方式!");
Mobile.focus();
return false;
}
else
{
if(Mobile.value!="")
{
var zzMobile=/^1[358][0-9]{9}$/;
if(!zzMobile.test(Mobile.value))
{
alert("手机格式不正确!");
Mobile.focus();
Mobile.select();
return false;
}
}
if(Telephone.value!="")
{
var zzTelephone=/^0[0-9]{2}[-]?[0-9]{8}|0[0-9]{3}[-]?[0-9]{7} $/;
if(!zzTelephone.test(Telephone.value))
{
alert("固定电话格式不正确!");
Telephone.focus();
Telephone.select();
return false;
}
}
}
}
//爱好
function checkLove()
{
var loves=document.getElementsByName("love");
var blove=false;
for(var i=0; i<loves.length;i++)
{
if(loves[i].checked)
{
blove=true;
}
}
if(!blove)
{
alert("爱好不能为空!");
return false;
}
}
function add()
{
//方法1
var Addtable=document.getElementById("px");
with(Addtable.firstChild)appendChild(lastChild.cloneNode(true));
//方法2
/*var Addtable=document.getElementById("px");
//给表格添加单元行
var tr=Addtable.insertRow();
//给单元行添加单元列
var td=tr.insertCell();
td.innerHTML="<input type='file' class='input' size='20'/> <input class='input' οnclick='add()' type='button' value='增加'/><input class='input' type='button' value='删除' οnclick='deletetable(this)'/>";*/
}
function deletetable(pindex)
{
var deltable=document.getElementById("px");
if(deltable.length==1)
{
alert("至少有一个上传图片的");
return;
}
//获取到当前对象的父节点的父节点的行索引
var i=pindex.parentElement.parentElement.rowIndex;
//通过行索引删除行
deltable.deleteRow(i);
}
</script>
</head>
<body >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><br />
<div class="currentP">当前位置:用户信息登记 </div>
<br />
<table width="97%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="48%">
<table width="100%" class="contentTitle">
<tr>
<td width="1%"><img src="images/bg_mcontentL.gif" /></td>
<td width="95%"><h3>个人信息</h3></td>
<td width="4%" align="right"><img src="images/bg_mcontentR.gif" /></td>
</tr>
</table>
<table width="100%" class="contentModule">
<tr>
<td><div class="contentModuleB">
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="DoubleColorTable">
<tr>
<td align="right">用户名:</td>
<td align="left"><input id="uname" type="text" class="input" value="" size="32" />
<span style="color:red
">*</span> <span class="gray">由英文字母(不区分大小写)、数字或下划线组成的3到20位字符,并以英文字母开头,如:itour168</span></td>
</tr>
<tr>
<td align="right" valign="top">性别:</td>
<td align="left"><input name="sex" type="radio" value="" />男 <input name="sex" type="radio" value="" />女<span style="color:red
">*</span></td>
</tr>
<tr>
<td align="right" valign="top">生日:</td>
<td align="left"><input name="birthday" onKeyDown="return false" οnpaste="return false" type="text" value="" size="15" class="input"/>
<img src="images/calender.gif" alt="日期" name="change3" width="25" height="21" align="absmiddle" id="change3" onClick="javascript:show_cele_date(change3,birthday);" />格式:yyyy-mm-dd</td>
</tr>
<tr>
<td align="right" valign="top">民族:</td>
<td align="left"><input id="mz" type="text" class="input" size="9" onClick="show()" /> <span style="color:red
">*</span>点击文本框进行选择</td>
</tr>
<tr>
<td align="right" valign="top">省份:</td>
<td align="left"><select id="dlarea" onChange="checkCity() "><option value="">请选择</option>
<option value="湖北省">湖北省</option>
<option value="湖南省">湖南省</option>
</select> <span style="color:red ">*</span></td>
</tr>
<tr>
<td align="right" valign="top">城市:</td>
<td align="left"><select id="dlcity"><option value="">请选择</option>
</select> <span style="color:red
">*</span></td>
</tr>
<tr>
<td align="right" valign="top">手机:</td>
<td align="left"><input id="mobile" type="text" class="input" value="" size="32" />
格式:13488888888</td>
</tr>
<tr>
<td align="right" valign="top">固定电话:</td>
<td align="left"><input id="telephone" type="text" class="input" value="" size="32" />
格式:027-88888888或0716-8888888 手机和固定电话请至少填写一项</td>
</tr>
<tr>
<td align="right" valign="top">爱好:</td>
<td align="left"><input type="checkbox" name="love" />
篮球<input type="checkbox" value="音乐" name="love"/>音乐
<input type="checkbox" value="旅游" name="love"/>旅游
<input type="checkbox" value="看书" name="love"/>看书
<span style="color:red ">*</span>请最少选择一项</td>
</tr>
<tr>
<td align="right" valign="top">学历:</td>
<td align="left"><select id="dlxl"><option value="">请选择</option><option value="硕士">硕士</option><option value="本科">本科</option>
<option value="大专">大专</option><option value="其他">其他</option></select></td>
</tr>
<tr>
<td width="20%" align="right">上传图片:</td>
<td width="80%" align="left"><table id="px"><tr><td><input type="file" class="input" size="20"/> <input class="input" type="button" value="增加" onClick="add()"/><input class="input" type="button" value="删除" onClick="deletetable(this)" /></td></tr></table></td>
</tr>
<tr>
<td align="right" valign="top">个人介绍:</td>
<td align="left"><textarea name="personalIntroduction" rows="2" cols="20"></textarea> </td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<br />
<div align="center">
<input type="button" class="button2" value="保存" onClick="return checkAll();" />
</div>
</td>
</tr>
</table>
<div id="jg" style="position:absolute; width:250px; height:120px; z-index:1;border: solid 1px #B1DE27; background-color:#FFFFFF; display:none; top:320px; left:450px">
<div style="width: 250px; height: 22px; background-color:#CCCCCC">
<a onClick="document.getElementById('jg').style.display='none'" title="关闭" style="cursor: pointer;float:right;margin-top:3px;display:inline;">×</a>
</div>
<div style="padding: 4px; border-top: 0px; padding-bottom: 8px; display: block; padding-top: 0px; padding-left: 5px;">
<input type="radio" value="汉族" name="jg1"/>汉族<input type="radio" name="jg1" value="维吾尔族"/>维吾尔族<input type="radio" name="jg1" value="朝鲜族"/>朝鲜族<input type="radio" name="jg1" value="白族"/>白族<br/><input name="jg1" type="radio" value="满族"/>满族<input name="jg1" type="radio" value="苗族"/>苗族<input name="jg1" type="radio" value="回族"/>回族<input type="radio" name="jg1" value="白族"/>白族<br/>
<input type="radio" name="jg1" value="藏族"/>藏族<input type="radio" name="jg1" value="羌族"/>羌族<input name="jg1" type="radio" value="壮族"/>壮族<input type="radio" value="傣族" name="jg1"/>傣族<br/>
</div>
<div align="center"><input type="button" value="确定" onClick="setValue()"/> <input type="button" value="关闭" onClick="document.getElementById('jg').style.display='none'" /></div>
</div>
<br />
</body>
</html>