Ajax.net实现loading登陆的效果
生活随笔
收集整理的這篇文章主要介紹了
Ajax.net实现loading登陆的效果
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
AjaxPro.dll
一,在aspx的頁(yè)面的代碼如下
?
一,在aspx的頁(yè)面的代碼如下
?1<%@?Page?Language="C#"?AutoEventWireup="true"?CodeFile="Default5.aspx.cs"?Inherits="ajaxproloading.Default5"?%>?2
?3<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
?4
?5<html?xmlns="http://www.w3.org/1999/xhtml"?>
?6<head?runat="server">
?7????<title>loaing</title>
?8????<script?language=javascript>
?9????function?Get_Name()
10????{
11??????var?name=document.getElementById("Text1").value;
12??????var?pwd=document.getElementById("Text2").value;
13??????ajaxproloading.Default5.GetLogin(name,pwd,CallBackServer);
14??????document.getElementById("loading").style.display="block";
15?????
16????}
17????function?CallBackServer(res)
18????{
19?????var?success=res.value;
20?????document.getElementById("loading").style.display="none";
21????
22?????if(success)
23?????{
24???????document.getElementById("ss").innerHTML="登陸成功";
25???????
26?????}
27?????else
28?????{
29???????document.getElementById("ss").innerHTML="登陸失敗";
30?????}
31????}
32????</script>
33</head>
34<body>
35????<form?id="form1"?runat="server">
36????<div>
37????????<input?id="Button1"?type="button"?value="button"?onclick="Get_Name();"?/>
38????????<input?id="Text1"?type="text"?/>
39???????????<input?id="Text2"?type="text"?/></div>
40????????<div?id="loading"?style="display:none;"><img?src=9.gif?/>正在登陸</div>
41???????<div?id="ss"></div>
42????</form>
43</body>
44</html>
45
二,.cs的代碼
?1using?System;?2using?System.Data;
?3using?System.Configuration;
?4using?System.Collections;
?5using?System.Web;
?6using?System.Web.Security;
?7using?System.Web.UI;
?8using?System.Web.UI.WebControls;
?9using?System.Web.UI.WebControls.WebParts;
10using?System.Web.UI.HtmlControls;
11using?System.Data.SqlClient;
12namespace?ajaxproloading
13{
14????public?partial?class?Default5?:?System.Web.UI.Page
15????{
16????????protected?void?Page_Load(object?sender,?EventArgs?e)
17????????{
18????????????AjaxPro.Utility.RegisterTypeForAjax(typeof(Default5));
19????????}
20????????[AjaxPro.AjaxMethod]
21????????public?bool?GetLogin(string?username,string?userpwd)
22????????{
23????????????System.Threading.Thread.Sleep(3000);
24????????????SqlConnection?con?=?new?SqlConnection("server=.;database=testajax;uid=sa;pwd=lanjie");
25????????????con.Open();
26????????????SqlCommand?com?=?new?SqlCommand();
27????????????com.CommandText?=?"select?*?from?userinfo?where?username='"?+?username?+?"'?and?userpwd='"?+?userpwd+"'";
28????????????com.Connection?=?con;
29????????????SqlDataReader?da?=?com.ExecuteReader();
30????????????if?(da.Read())
31????????????{
32????????????????con.Close();
33????????????????return?true;
34????????????}
35????????????else
36????????????{
37????????????????con.Close();
38????????????????return?false;
39????????????}
40????????}
41????}
42}
43
?
?
平時(shí)中 收集的 其他高手的東西來(lái)補(bǔ)充自己咯。!!!
【源自】http://www.cnblogs.com/symjie520/archive/2007/04/17/716571.html
轉(zhuǎn)載于:https://www.cnblogs.com/meiyou/archive/2009/06/01/1493747.html
總結(jié)
以上是生活随笔為你收集整理的Ajax.net实现loading登陆的效果的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 黄忠---忠心不二主
- 下一篇: Entity Framework 学习高