62,265
社区成员
发帖
与我相关
我的任务
分享<head runat="server">
<title>无标题页</title>
<style type="text/css">
body
{
font-size: 9pt;
}
</style>
<script type="text/javascript">
var i=4;
function Ref()
{
if(i>0)
{
i--;
document.getElementById("d2").innerHTML="登陆成功,三秒后跳转到个人管理"+i+",如果未跳转,<a href='Manage.htm' style='color:red'>请点击</a>";
}
else
{
//var ref = document.getElementById("a1");
//a1.click();
location.href="Manage.htm";
document.getElementById("d2").innerHTML="登陆成功,三秒后跳转到个人管理"+i+",如果未跳转,<a href='Manage.htm' style='color:red'>请点击</a>";
}
}
setInterval("Ref()",1000);
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="d1" runat="server" style="width:200px; height: 100px; display:block; border: 1px solid black">
用户名:<asp:TextBox ID="txt_UserName" runat="server"></asp:TextBox>
<br />
密 码:<asp:TextBox ID="txt_Password" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Btn_Login" runat="server" Text="登陆" OnClick="Btn_Login_Click" />
</div>
<div id="d2" runat="server" style="display:none;">
</div>
</form>
</body> protected void Btn_Login_Click(object sender, EventArgs e)
{
try
{
if (txt_UserName.Text == "zzz" && txt_Password.Text == "zzz")
{
HtmlGenericControl h1 = (HtmlGenericControl)form1.FindControl("d1");
h1.Attributes["style"] = "display:none";
HtmlGenericControl h2 = (HtmlGenericControl)form1.FindControl("d2");
h2.Attributes["style"] = "display:block;border:1px solid black; width: 500px; height: 100px;";
h2.Attributes["onload"] = "Ref()";
}
else
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "<script>alert('用户名或密码错误!')</script>");
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}