终于完成第一个Ajax……
2007-01-13 11:19
351 查看
2天时间的查资料学习,终于走完了AJAX学习的第一步,第一个例子成功完成……
源代码:
ASPX:
1
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>李智的第一个AJAX应用程序</title>
8</head>
18<body>
19 <form id="form1" runat="server">
20 <div>
21 <input id="first" type="text" size="5" /> + <input id="second" type="text" size="5" /> = <input id="result" type="text" size="5" /> <input id="calc" type="button" value="计算" onclick="ClientAdd()" />
22 </div>
23 </form>
24</body>
25</html>
26
CS:
1using System;
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
10using AjaxPro;
11
12
13[System.Web.Services.WebService]
14public partial class _Default : System.Web.UI.Page
15
Web.Config
1<?xml version="1.0"?>
2<!--
3 注意: 除了手动编辑此文件以外,您还可以使用
4 Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
5 “网站”->“Asp.Net 配置”选项。
6 设置和注释的完整列表在
7 machine.config.comments 中,该文件通常位于
8 \Windows\Microsoft.Net\Framework\v2.x\Config 中
9-->
10<configuration>
11 <appSettings/>
12 <connectionStrings/>
13 <system.web>
14 <httpHandlers>
15 <!-- Register the ajax handler 手动添加注册----LiZhi-->
16 <add verb="*" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
17 </httpHandlers>
18 <!--
19 设置 compilation debug="true" 将调试符号插入
20 已编译的页面中。但由于这会
21 影响性能,因此只在开发过程中将此值
22 设置为 true。
23 -->
24 <compilation debug="false">
25 <assemblies>
26 <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
27 <!--
28 通过 <authentication> 节可以配置 ASP.NET 使用的
29 安全身份验证模式,
30 以标识传入的用户。
31 -->
32 <authentication mode="Windows"/>
33 <!--
34 如果在执行请求的过程中出现未处理的错误,
35 则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
36 开发人员通过该节可以配置
37 要显示的 html 错误页
38 以代替错误堆栈跟踪。
39
40 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
41 <error statusCode="403" redirect="NoAccess.htm" />
42 <error statusCode="404" redirect="FileNotFound.htm" />
43 </customErrors>
44 -->
45 </system.web>
46</configuration>
47
源代码:
ASPX:
1
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>李智的第一个AJAX应用程序</title>
8</head>
18<body>
19 <form id="form1" runat="server">
20 <div>
21 <input id="first" type="text" size="5" /> + <input id="second" type="text" size="5" /> = <input id="result" type="text" size="5" /> <input id="calc" type="button" value="计算" onclick="ClientAdd()" />
22 </div>
23 </form>
24</body>
25</html>
26
CS:
1using System;
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
10using AjaxPro;
11
12
13[System.Web.Services.WebService]
14public partial class _Default : System.Web.UI.Page
15
Web.Config
1<?xml version="1.0"?>
2<!--
3 注意: 除了手动编辑此文件以外,您还可以使用
4 Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
5 “网站”->“Asp.Net 配置”选项。
6 设置和注释的完整列表在
7 machine.config.comments 中,该文件通常位于
8 \Windows\Microsoft.Net\Framework\v2.x\Config 中
9-->
10<configuration>
11 <appSettings/>
12 <connectionStrings/>
13 <system.web>
14 <httpHandlers>
15 <!-- Register the ajax handler 手动添加注册----LiZhi-->
16 <add verb="*" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
17 </httpHandlers>
18 <!--
19 设置 compilation debug="true" 将调试符号插入
20 已编译的页面中。但由于这会
21 影响性能,因此只在开发过程中将此值
22 设置为 true。
23 -->
24 <compilation debug="false">
25 <assemblies>
26 <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
27 <!--
28 通过 <authentication> 节可以配置 ASP.NET 使用的
29 安全身份验证模式,
30 以标识传入的用户。
31 -->
32 <authentication mode="Windows"/>
33 <!--
34 如果在执行请求的过程中出现未处理的错误,
35 则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
36 开发人员通过该节可以配置
37 要显示的 html 错误页
38 以代替错误堆栈跟踪。
39
40 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
41 <error statusCode="403" redirect="NoAccess.htm" />
42 <error statusCode="404" redirect="FileNotFound.htm" />
43 </customErrors>
44 -->
45 </system.web>
46</configuration>
47
相关文章推荐
- 我的第一个APP终于完成初稿。
- 我的第一个ajax 自动完成
- 终于完成了第一个arduino控制的小车
- 终于完成了第一个完整的编译程序
- 终于完成第一个项目任务
- 终于完成了第一个arduino控制的小车
- DzzOffice Alpah 第一个版本终于完成发布(webos类产品)
- 终于完成第一个Wss3上WebPart(treeview 目录树形控件)
- 终于完成了第一个商业网站作品初稿,写些心得
- 跨过几个坑,终于完成了我的第一个Xamarin Android App!
- 我和DELPHI不得不说的故事之-------终于在半独立的状态下完成了第一个程序
- AJAX根据邮政编码,自动完成城市和地址信息
- 可输入的下拉列表+Ajax自动完成
- 使用Node.js完成的第一个项目的实践总结
- 使用XMLHttpRequest对象完成原生的AJAX请求
- 用android完成第一个helloworld
- XJOJ历经2个月终于完成啦~~
- 终于开通了我的第一个博客
- 噩梦---如何完成我的第一个商用软件
- !!终于把【库存管理的大致功能完成了!】