//海娃@2003-10-23 15:33:21
var oType=document.form.act.value;
var id;
var field_str="*";
var field_img_str="";
function LoadHtm()
{
if(GetCookie("L_name")!=null&&GetCookie("L_sid")!=null&&GetCookie("L_sid")!="")
{
id=GetCookie("L_sid")
var xmlcmd = '';
root=ExecXmlCmd(xmlcmd);
if (root!=null)
{
var data = root.childNodes.item(0);
row = data.childNodes.item(0);
if (row.getAttribute("UserName")!=null)
{
document.all.UserName.innerText=row.getAttribute("UserName");
}
if (row.getAttribute("Sex")!=null)
{
document.form.Sex_check_radio.value=row.getAttribute("Sex");
}
function Sex_check()
{
var Sexi=0;
var Sexstr1 = document.form.Sex_check_radio.value;
for(Sexi=0 ;Sexi-1){document.form.Sex[Sexi].checked = true;}
else{document.form.Sex[Sexi].checked = false;}
}
}
Sex_check();
if (row.getAttribute("Address")!=null)
{
document.form.Address.value=row.getAttribute("Address");
}
if (row.getAttribute("Company")!=null)
{
document.form.Company.value=row.getAttribute("Company");
}
if (row.getAttribute("Age")!=null){
document.form.Age.value=row.getAttribute("Age");
}
if (row.getAttribute("True_name")!=null){
document.form.True_name.value=row.getAttribute("True_name");
}
if (row.getAttribute("Zip")!=null){
document.form.Zip.value=row.getAttribute("Zip");
}
if (row.getAttribute("Tel")!=null){
document.form.Tel.value=row.getAttribute("Tel");
}
if (row.getAttribute("Email")!=null)
{
document.form.Email.value=row.getAttribute("Email");
}
if (row.getAttribute("Likes")!=null)
{
document.form.Likes.value=row.getAttribute("Likes");
}
if (row.getAttribute("Text")!=null)
{
document.form.Text.value=row.getAttribute("Text");
}
}
else
{
alert("服务器错误!")
}
}
else
{
alert("您没有登录!");top.location.href="index.htm"
}
}
function btSubmit()
{
var xmlcmd2=""
xmlcmd2+= ' Pass_word="'+FixXml(FixSql(document.form.Pass_word.value))+'"'
xmlcmd2+= ' Sex="'+FixXml(FixSql(document.form.Sex_check_radio.value))+'"'
xmlcmd2+= ' Address="'+FixXml(FixSql(document.form.Address.value))+'"';
xmlcmd2+= ' Company="'+FixXml(FixSql(document.form.Company.value))+'"'
xmlcmd2+= ' Age="'+FixXml(FixSql(document.form.Age.value))+'"'
xmlcmd2+= ' True_name="'+FixXml(FixSql(document.form.True_name.value))+'"'
xmlcmd2+= ' Zip="'+FixXml(FixSql(document.form.Zip.value))+'"'
xmlcmd2+= ' Tel="'+FixXml(FixSql(document.form.Tel.value))+'"'
xmlcmd2+= ' Email="'+FixXml(FixSql(document.form.Email.value))+'"'
xmlcmd2+= ' Likes="'+FixXml(FixSql(document.form.Likes.value))+'"'
xmlcmd2+= ' Text="'+FixXml(FixSql(document.form.Text.value))+'"'
xmlcmd2+= ' Reg_date="2008-7-25 9:00:21"';
var xmlcmd = ''
//alert(xmlcmd);
root=ExecXmlCmd(xmlcmd);
if (root!=null)
{
alert("注册成功,请登录!");form.reset();top.location.href="index.htm";
}
else
{
alert("提交不成功!请重新提交!");
}
}
function update()
{
var xmlcmd2=""
var info_ok=""
if (document.form.Pass_word.value!="")
{
info_ok="密码和资料";
xmlcmd2+= ' Pass_word="'+FixXml(FixSql(document.form.Pass_word.value))+'"'
}
xmlcmd2+= ' Sex="'+FixXml(FixSql(document.form.Sex_check_radio.value))+'"'
xmlcmd2+= ' Address="'+FixXml(FixSql(document.form.Address.value))+'"';
xmlcmd2+= ' Company="'+FixXml(FixSql(document.form.Company.value))+'"'
xmlcmd2+= ' Age="'+FixXml(FixSql(document.form.Age.value))+'"'
xmlcmd2+= ' True_name="'+FixXml(FixSql(document.form.True_name.value))+'"'
xmlcmd2+= ' Zip="'+FixXml(FixSql(document.form.Zip.value))+'"'
xmlcmd2+= ' Tel="'+FixXml(FixSql(document.form.Tel.value))+'"'
xmlcmd2+= ' Email="'+FixXml(FixSql(document.form.Email.value))+'"'
xmlcmd2+= ' Likes="'+FixXml(FixSql(document.form.Likes.value))+'"'
xmlcmd2+= ' Text="'+FixXml(FixSql(document.form.Text.value))+'"'
//xmlcmd2+= ' Reg_date="2008-7-25 9:00:21"';
var xmlcmd = ''
//alert(xmlcmd);
root=ExecXmlCmd(xmlcmd);
if (root!=null)
{
alert(info_ok+"更新成功!");top.location.href="index.htm";
}
else
{
alert("提交不成功!请重新提交!");
}
}
function strlength(str){
var l=str.length;
var n=l
for (var i=0;i255) n++
}
return n;
}
function chkform(act){
var er="";
if (act!="update")
{
if ((strlength(form.UserName.value)>20)|(strlength(form.UserName.value)<3))
{
alert(er + "用户名长度必须在3-20之间");
form.UserName.focus();
return false;
}
}
//单复选框取值
var Sexi,Sexn=0;
var Sexvv="";
for(Sexi=0;Sexi0))
{
if ((strlength(form.Pass_word.value)>20)|(strlength(form.Pass_word.value)<6))
{
alert(er + "密码长度必须在6-20之间");
form.Pass_word.focus();
return false;
}
if (form.Pass_word.value!=form.rePass_word.value)
{
alert(er + "密码与确认不一样");
form.Pass_word.value="";
form.rePass_word.value="";
form.Pass_word.focus( );
return false;
}
}
}
else
{
if ((strlength(form.Pass_word.value)>20)|(strlength(form.Pass_word.value)<6))
{
alert(er + "密码长度必须在6-20之间");
form.Pass_word.focus();
return false;
}
if (form.Pass_word.value!=form.rePass_word.value)
{
alert(er + "密码与确认不一样");
form.Pass_word.value="";
form.rePass_word.value="";
form.Pass_word.focus( );
return false;
}
}
if ((strlength(form.True_name.value)>8)|(strlength(form.True_name.value)<0))
{
alert(er + "真实姓名长度太长");
form.True_name.focus();
return false;
}
if (act=="update")
{
if (strlength(form.Address.value)<1)
{
alert(er + "地址必须填写完整");
form.Address.focus();
return false;
}
}
else
{
if ((strlength(form.Province.value)<1)|(strlength(form.City.value)<1)|(strlength(form.Address.value)<1))
{
alert(er + "地址必须填写完整");
form.Address.focus();
return false;
}
}
if (isNaN(form.Zip.value)|strlength(form.Zip.value)!=6)
{
alert(er + "邮编必须为6位数字");
form.Zip.focus();
return false;
}
if (isNaN(form.Age.value)|(strlength(form.Age.value)>2)|(strlength(form.Age.value)<1))
{
alert(er + "请输入您的年龄");
form.Age.value="";
form.Age.focus();
return false;
}
if (!isMail(form.Email.value))
{
alert(er + "E-mail格式不正确");
form.Email.focus();
return false;
}
if ((strlength(form.Likes.value)>100)|(strlength(form.Likes.value)<0))
{
alert(er + "个人爱好长度必须在0-100之间,现在长度为"+strlength(form.Likes.value));
form.Likes.focus();
return false;
}
if ((strlength(form.Text.value)>255)|(strlength(form.Text.value)<0))
{
alert(er + "个人说明长度必须在0-255之间,现在长度为"+strlength(form.Text.value));
form.Text.focus();
return false;
}
if (act!="update")
{
checkid=Request("id");
if (checkid==""){id=0}
staus=Check_Field("Users",checkid,"id","or","UserName/用户名|Email/E-mail");
if (!staus)
{
return false;
}
}
form_ck=true;
if (act=="update")
{
update();
}
else
{
btSubmit();
}
}