您的位置:首页 > 其它

研究Ajax(二)WebService实现加 减 乘 除

2006-12-05 09:35 246 查看
环境:VS2005 并在http://ajax.asp.net/default.aspx?tabid=47&subtabid=471下载安装ASP.NET AJAX 1.0 Beta 2
效果:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<script type="text/javascript" language="JavaScript">
function Sum()
function Diff()
function Mul()
function Quotient()
function OnRequestComplete(result)
</script>

<body>
<form id="form1" runat="server">
<asp:scriptmanager ID="Scriptmanager1" runat="server">
<Services>
<asp:ServiceReference Path="MyService.asmx"/>
</Services>
</asp:scriptmanager>
<table border="0" cellspacing="3" bgcolor="#898989">
<tr bgcolor="#e9e9e9">
<td>
<input type="text" id="input1" size="20" /></td>
<td align="center">
+</td>
<td>
<input type="text" id="input2" size="20" /></td>
<td style="width: 25px">
<input id="button1" type="button" value="和" onclick="return Sum()" /></td>
<td rowspan="4" style="width: 25px"> <label id="Flag" style="color:Red;"></label>
</td>
</tr>
<tr bgcolor="#e9e9e9">
<td>
<input type="text" id="input3" size="20" /></td>
<td align="center">
-</td>
<td>
<input type="text" id="input4" size="20" /></td>
<td style="width: 25px"> <input id="button2" type="button" value="减" onclick="return Diff()" />
</td>
</tr>
<tr bgcolor="#e9e9e9">
<td>
<input type="text" id="input5" size="20" /></td>
<td align="center">
*</td>
<td>
<input type="text" id="input6" size="20" /></td>
<td style="width: 25px"><input id="button3" type="button" value="乘" onclick="return Mul()" />
</td>
</tr>
<tr bgcolor="#e9e9e9">
<td>
<input type="text" id="input7" size="20" /></td>
<td align="center">
/</td>
<td>
<input type="text" id="input8" size="20" /></td>
<td style="width: 25px"><input id="button4" type="button" value="除" onclick="return Quotient()" />
</td>
</tr>
</table>
</form>
</body>
</html>
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;

[Microsoft.Web.Script.Services.ScriptService]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: