怎么用html做一个系统登录界面文本框前有小图案

怎么用html做一个系统登录界面文本框前有小图案,第1张

以下为个人原创教学例子,任何人引用需注明出自百度知道用户am7972,楼主可供参考
该例子涵盖了文本框、密码框、下拉菜单、单选框、复选框及文本区的使用
同时在数据的使用方面涵盖了文本型、数值型、日期型、布尔型的使用
也涵盖了在会员信息入数据库前,进行严格的数据检查
不足处,JS验证还不是太完善,不过有服务端认证足够了
<title>会员注册</title>
<script type="text/javascript">
<!--function CheckForm()
{
if(documentuserinfousernamevalue == "")
{ alert("请输入姓名,姓名不能为空!");
documentuserinfousernamefocus();
return false;
}
if(documentuserinfousernamevaluelength > 10)
{
alert("输入的姓名长度最多为10个字符!");
documentuserinfousernamefocus();
return false;
}
}
//--></script>
</head>
<body>
<table border="1" width="53%" bordercolorlight="#000000" cellspacing="0" id="table1" height="358" bordercolor="#000000" bordercolordark="#FFFFFF" cellpadding="0">
<form method="POST" action="bbasp" name="userinfo" onsubmit="return CheckForm();">
<tr><td colspan="2" height="37"> <p align="center">会员注员</td> </tr>
<tr> <td width="37%" align="right">姓名:</td> <td width="61%"> <input type="text" name="username" value="libin" size="13"> </td> </tr>
<tr> <td width="37%" align="right">密码:</td> <td width="61%"> <input type="password" name="userPassword" size="20" value="123"></td> </tr>
<tr> <td width="37%" align="right">性别:</td> <td width="61%"><input type="radio" value="True" checked name="Sex">男 <input type="radio" name="Sex" value="False">女</td> </tr>
<tr> <td width="37%" align="right">生日:</td> <td width="61%"> <input type="text" name="userSR" size="11" value="1985-03-12"></td> </tr>
<tr> <td width="37%" align="right">年龄:</td> <td width="61%"><input type="text" name="userNL" size="9" value="13"></td> </tr>
<tr> <td width="37%" align="right">爱好:</td> <td width="61%"> <input type="checkbox" name="ah" value="sw">上网 <input type="checkbox" name="ah" value="ds" checked>读书 <input type="checkbox" name="ah" value="ty">体育</td> </tr>
<tr> <td width="37%" align="right">上网方式:</td> <td width="61%">
<select size="1" name="swfs"> <option selected value="bhsw">拨号上网</option> <option value="wxsw">无线上网</option> <option value="gxsw">光纤上网</option> </select>
</td> </tr>
<tr> <td width="37%" align="right">个人简介:</td> <td width="61%"><textarea rows="9" name="userGrjs" cols="34"></textarea></td> </tr> <tr> <td colspan="2" height="38"> <p align="center"><input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td>
</tr>
</form>
</table>
====bbasp的会员注册非法数据监测====
<%
username = Request("username")
userPassword = Request("userPassword")
Sex = Request("Sex")
userSR = Request("userSR")
userNL = Request("userNL")
ah = Request("ah")
swfs = Request("swfs")
userGrjs = Request("userGrjs")
'判断数据合法性,绝对不能让非法数据进入系统
'判断姓名username合不合法,是否包含非法数据
username = Trim(username) '例如:" 张 三 "经过处理之后变成"张 三"
If username ="" Then
Responsewrite "姓名不能为空"
ResponseEnd
End If
If Len(username)>10 Then
Responsewrite "姓名字数不能超过10个字" 'Len("Z")=1 Len("国")=2
ResponseEnd
End If
For i = 1 To Len(username)
q = Mid(username,i,1)
If InStr("!@#$%^&()_-+|<>/"",",q)>0 Then
Responsewrite "姓名不能包含特殊符号!@#$%^&()_-+|<>/"","
ResponseEnd
End If
Next
'判断密码合不合法,是否包含非法数据userPassword = Trim(userPassword)If userPassword ="" Then Responsewrite "密码不能为空" ResponseEndEnd If
If Len(userPassword)>20 Then
Responsewrite "密码字数不能超过20个字"
ResponseEnd
End If
'判断密码合不合法,是否包含非法数据
Sex = Trim(Sex)
If Sex = "" Then
Responsewrite "性别不能为空"
ResponseEnd
End If
If Sex <> "True" And Sex <> "False" Then
Responsewrite "性别不能为不男不女"
ResponseEnd
End If
'判断生日合不合法,是否包含非法数据
userSR = Trim(userSR)
If userSR ="" Then
Responsewrite "生日不能为空"
ResponseEnd
End If
If Len(userSR)<8 Or Len(userSR)>10 Then '例如:2012-6-3 2012-11-23
Responsewrite "你输入的生日字数不对,应为2012-6-3或2012-11-23格式"
ResponseEnd
End If
If IsDate(userSR)=False Then
Responsewrite "你输入的生日格式不能转化为日期,请核实"
ResponseEnd
End If
If DateDiff("yyyy",userSR,Date())<1 Or DateDiff("yyyy",userSR,Date())>200 Then
Responsewrite "根据你输入的生日你可能小于1岁或已经超过200岁了,请核查重新输入"
ResponseEnd
End If
'判断年龄合不合法,是否包含非法数据userNL = Trim(userNL)If userNL ="" Then
Responsewrite "年龄不能为空"
ResponseEnd
End If
If IsNumeric(userNL)=False Then
Responsewrite "你输入的年龄不能转化为数值,请核查"
ResponseEnd
End If
userNL = CInt(userNL)
If userNL<0 Or userNL>200 Then
Responsewrite "你输入的年龄不能小于0岁或者大于200岁,请核查"
ResponseEnd
End If
'判断爱好合不合法,是否包含非法数据ah = Trim(ah) '选择多个爱好则系统会用,分开 //测试
ah = Replace(ah," ","")
arrAh = Split(ah,",")
For i = LBound(arrAh) To UBound(arrAh)
If arrAh(i)<>"sw" And arrAh(i)<>"ds" And arrAh(i)<>"ty" Then
Responsewrite i & "你选择的爱好有问题,请核查" & arrAh(i)
ResponseEnd
End If
Next
'判断上网方式合不合法,是否包含非法数据swfs = Trim(swfs)If swfs = "" Then
Responsewrite "上网方式不能为空"
ResponseEnd
End If
If swfs<>"bhsw" And swfs<>"wxsw" And swfs<>"gxsw" Then
Responsewrite "你选择的上网方式有问题,请核查"
ResponseEnd
End If
'判断个人简介是否为空,是否超出1000个字
userGrjs = Trim(userGrjs)
If userGrjs = "" Then
Responsewrite "个人简介不能为空"
ResponseEnd
End If
If Len(userGrjs) > 1000 Then
Responsewrite "个人简介不能超过1000个字"
ResponseEnd
End If
Responsewrite "数据合法性检测通过"
%>
====登陆的HTML代码可相信楼主参照会员注册代码应该没问题了====


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/13355460.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-20
下一篇 2023-07-20

发表评论

登录后才能评论

评论列表(0条)

保存