<script type="text/javascript">
function check()
{
if(document.getElementById("TextBox1").value=="")
{
document.getElementById('TextBox1').focus();
return false;
}
if(document.getElementById("TextBox2").value=="")
{
document.getElementById('TextBox2').focus();
return false;
}
return true;
}
</script>
</head>
<body onload="document.getElementById('TextBox1').focus()" >
<form id="form1" runat="server" onsubmit="return check()">
function check()
{
if(document.getElementById("TextBox1").value=="")
{
document.getElementById('TextBox1').focus();
return false;
}
if(document.getElementById("TextBox2").value=="")
{
document.getElementById('TextBox2').focus();
return false;
}
return true;
}
</script>
</head>
<body onload="document.getElementById('TextBox1').focus()" >
<form id="form1" runat="server" onsubmit="return check()">
解决方案 »
- WebForm_SaveScrollPositionSubmit 未定义
- 测试过的程序传到服务器上老出问题,为什么??
- 如何设置GridView模版列的宽度,并把多余的字截掉或显示“…”
- asp.net中上传图片后记录在服务器的路径并绑定在image控件上的问题
- 兄弟姐妹们,有谁使用过AspNetPager分页控件4.3的进来帮下忙!
- 谁有省市县乡四级的数据库?
- Asp.Net调用MySql存储过程时,报Connection unexpectedly terminated ?有谁知道啊!!!
- 在C#中,怎樣繼承窗體
- 如果实现"返回"功能及禁用FRAME页面的CACHE
- 从微软网站找到了关于ASP.net的好东东,贴出来与大家共同分享!
- Visual Web Developer 2008 速成版 启动调试时为什么很长时间后才能打开IE
- .ashx文件中Response.Write XML不稳定
或
<input type="submit" name="Submit1" value="提交" />
你搞个alert试试,代码应该没有问题
function check()
{
if(document.getElementById("TextBox1").value=="")
{
document.getElementById('TextBox1').focus();
return false;
}
if(document.getElementById("TextBox2").value=="")
{
document.getElementById('TextBox2').focus();
return false;
}
//return true;
}
</script>
</head>
<body onload="document.getElementById('TextBox1').focus()" >
<form id="form1" runat="server" onsubmit="return check()">
<div class ="div1" >
<div class ="head" >
</div>
<div class ="cnt" >
<div class ="div11" >
<div class ="div2" >
</div>
<div class ="div3" >
<div class ="div4" >
<table style ="margin-top :30px;">
<tr>
<td class ="td1" >
学 号:</td>
<td class ="td2" >
<asp:TextBox ID="TextBox1" runat="server" CssClass ="textBox"></asp:TextBox></td>
</tr>
<tr>
<td class ="td1" >
密 码:</td>
<td class ="td2">
<asp:TextBox ID="TextBox2" TextMode="password" runat="server" CssClass ="textBox"></asp:TextBox></td>
</tr>
<tr>
<td class ="td1">
角 色:</td>
<td class ="td2">
<asp:DropDownList ID="DropDownList1" runat="server" CssClass ="dropDown">
</asp:DropDownList></td>
</tr>
<tr>
<td class ="td3" colspan="2">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/loginbtn.jpg" OnClick="ImageButton1_Click" />
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Images/resetbtn.jpg" /></td>
</tr>
</table>
</div>
</div>
<div class ="div5" >
</div>
</div>
</div>
</div>
</form>
</body>
</html>
确实是没有反应.怪了!!!!!
<script type="text/javascript">
function check()
{
if(document.getElementById("TextBox1").value=="")
{
document.getElementById('TextBox1').focus();
return false;
}
if(document.getElementById("TextBox2").value=="")
{
document.getElementById('TextBox2').focus();
return false;
}
//return true;
}
</script>
</head>
<body onload="document.getElementById('TextBox1').focus()" >
<form name="form1" method="post" action="login.aspx" id="form1" onsubmit="return check()">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODAyNjM1NzkwD2QWAgIDD2QWAgIFDxAPFgYeDkRhdGFWYWx1ZUZpZWxkBQdyb2xlX2lkHg1EYXRhVGV4dEZpZWxkBQlyb2xlX25hbWUeC18hRGF0YUJvdW5kZ2QQFQQG5a2m55SfBuaVmeW4iA/ogIPor5XnrqHnkIblkZgM5oC7566h55CG5ZGYFQQKMDkwNzEyNDU2NgowOTA3MTI0NTY1CjA5MDcxMjQ1NjQKMDkwNzEyNDU2MxQrAwRnZ2dnZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgIFDEltYWdlQnV0dG9uMQUMSW1hZ2VCdXR0b24yH7dVDk5NGHZjPOcRGOlPvFZynCw=" />
</div> <div class ="div1" >
<div class ="head" >
</div>
<div class ="cnt" >
<div class ="div11" >
<div class ="div2" >
</div>
<div class ="div3" >
<div class ="div4" >
<table style ="margin-top :30px;">
<tr>
<td class ="td1" >
学 号:</td>
<td class ="td2" >
<input name="TextBox1" type="text" id="TextBox1" class="textBox" /></td>
</tr>
<tr>
<td class ="td1" >
密 码:</td>
<td class ="td2">
<input name="TextBox2" type="password" id="TextBox2" class="textBox" /></td>
</tr>
<tr>
<td class ="td1">
角 色:</td>
<td class ="td2">
<select name="DropDownList1" id="DropDownList1" class="dropDown">
<option value="0907124566">学生</option>
<option value="0907124565">教师</option>
<option value="0907124564">考试管理员</option>
<option value="0907124563">总管理员</option></select></td>
</tr>
<tr>
<td class ="td3" colspan="2">
<input type="image" name="ImageButton1" id="ImageButton1" src="Images/loginbtn.jpg" style="border-width:0px;" />
<input type="image" name="ImageButton2" id="ImageButton2" src="Images/resetbtn.jpg" style="border-width:0px;" /></td>
</tr>
</table>
</div>
</div>
<div class ="div5" >
</div>
</div>
</div>
</div>
<div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCQKoxNnUBwLs0bLrBgLs0fbZDALhh5jtCALhh5ztCALhh4DtCALhh6TtCALSwpnTCALSwtXkAoIKhs7ZkwH9Tg9PMNfzV/t8gKVd" />
</div></form>
</body>
</html>页面源文件
<script type="text/javascript">
function check()
{
if(document.getElementById("<%=TextBox1.ClientID %>").value=="")
{
document.getElementById("<%=TextBox1.ClientID %>").focus();
return false;
}
if(document.getElementById("<%=TextBox2.ClientID %>").value=="")
{
document.getElementById("<%=TextBox2.ClientID %>").focus();
return false;
}
}
</script> <body onload="document.getElementById('<%=TextBox1.ClientID %>').focus()" > <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/loginbtn.jpg" OnClientClick="return check()" />