实现jquery校验
迷茫的野马 2013-09-30 03:25:37 本人菜鸟一个,希望大神多多指教,最好能把代码下来,谢谢各位了!!!!
<script src="../Script/jquery-1.8.3.js" type="text/javascript"></script>
<script type="text/javascript">
function checkName() {
var name = document.getElementById("txtUserName").value;
if (name == "") {
alert("请输入用户名");
}else{
alert("用户名可用!!!!");
}
}
</script>
这样写的没有效果,请各位高手多多指点。
<table cellspacing="0" cellpadding="0" width="100%" border="0" style="text-align: center">
<tr>
<td class="tdbg">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td height="25" width="30%" align="right">
用户名 :
</td>
<td height="25" width="*" align="left">
<asp:TextBox ID="txtUserName" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td height="25" width="30%" align="right">
密码 :
</td>
<td height="25" width="*" align="left">
<asp:TextBox ID="txtUserPwd" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td height="25" width="30%" align="right">
电话 :
</td>
<td height="25" width="*" align="left">
<asp:TextBox ID="txtUserPone" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td height="25" width="30%" align="right">
邮箱 :
</td>
<td height="25" width="*" align="left">
<asp:TextBox ID="txtUserEmail" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td height="25" width="30%" align="right">
上级 :
</td>
<td height="25" width="*" align="left">
<asp:DropDownList ID="DropDownListUpsID" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td height="25" width="30%" align="right">
部门 :
</td>
<td height="25" width="*" align="left" valign="bottom">
<asp:DropDownList ID="DropDownDeptID" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td height="25" width="30%" align="right">
职位 :
</td>
<td height="25" width="*" align="left">
<asp:DropDownList ID="DropDownPositionID" runat="server">
</asp:DropDownList>
</td>
</tr>
</table>