哪位牛人帮我看看,今天下午郁闷了整个下午,我想获得页面上所有文本框的对象,但是页面上只有四个文本框,而我弹出来的却是11个,不知道这11个是怎么出来的。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddManager.aspx.cs" Inherits="tny3j.Admin.rightcontent.AddManager" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<link href="../css/top.css" rel="stylesheet" type="text/css" />
<link href="../css/skin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
function checkwrite()
{
var item=document.getElementsByTagName("INPUT");
var j=0;
if(item!=null)
{
for(var i=0;i<item.length;i++)
{
j++;
if(item[i].type=="text" && item[i].textType=="MustWrite" && item[i].value=="")
{
item[i].className = "error";
}
else if(item[i].type=="text" && item[i].textType=="MustWrite"&& item[i].value!="")
{
item[i].className = "pass";
}
else
{
item[i].className = "";
}
}
}
//alert(item.length);//真的搞不懂,这里为什么会是11
if(j>0)
{
alert("输入不完整,请重新输入!");
return false;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<!--工具栏-->
<table cellspacing="0" cellpadding="2" border="0" width="100%" class="toolbg">
<tbody>
<tr>
<td nowrap="nowrap" align="left" class="barspace toolbgline">
<asp:Button ID="btnTopSave" runat="server" Text="添加或修改"/>
<input type="button" onclick="javascript:history.back(-1);" value=" 取消 " /> </td>
</tr>
</tbody>
</table>
<!--主体-->
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="settingtable">
<tbody>
<tr>
<td colspan="2">
<div style="padding: 8px 0pt 4px 2px; font-size: 14px;" class="addr_line">添加/修改管理员信息</div>
</td>
</tr>
<tr>
<td class="left_td" align="right">要创建的帐号:</td>
<td align="left">
<asp:TextBox ID="txtUserName" runat="server" textType="MustWrite" CssClass="txt"></asp:TextBox>
</td>
</tr>
<tr>
<td class="left_td" align="right">密码:</td>
<td align="left">
<asp:TextBox ID="txtPassword" runat="server" textType="MustWrite" CssClass="txt"></asp:TextBox></td>
</tr>
<tr>
<td class="left_td" align="right">重复密码:</td>
<td align="left">
<asp:TextBox ID="txtRePassword" runat="server" textType="MustWrite" CssClass="txt"></asp:TextBox>
</td>
</tr>
<tr>
<td class="left_td" align="right">真实姓名:</td>
<td align="left"><asp:TextBox ID="txtTrueName" runat="server" textType="MustWrite" CssClass="txt"></asp:TextBox></td>
</tr>
<tr>
<td class="left_td" align="right">是否拥有完全权限:</td>
<td align="left"><asp:CheckBox ID="cbVisible" runat="server"/>(注:此选项须拥有完全权限的管理员才可以操作)</td>
</tr>
</tbody>
</table>
<!--工具栏-->
<table cellspacing="0" cellpadding="2" border="0" width="100%" class="toolbg">
<tbody>
<tr>
<td nowrap="nowrap" align="left" class="barspace toolbgline">
<asp:Button ID="btnBottomSave" runat="server" Text="添加或修改" />
<input type="button" onclick="javascript:history.back(-1);" value=" 取消 " />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
你右击页面查看源代码看看 不只4个吧···