VS 2008可以非常完美地支持javascript和ASP.NET AJAX的智能感知和调试。.NET 3.5内置了ASP.NET AJAX,并且UpdatePanel终于可以支持WebPart了。 示例 Feature.js(被aspx页引用的js文件) 以下为引用的内容: // 创建一个math类 window.math = function() { /// 数学函数类 } window.math.prototype = { // 为math类创建一个max方法 max: function(x, y) { /// 返回两个整数中的最大的一个 /// 需要比较的第一个整数 /// 需要比较的第二个整数 if (x > y) return x; else return y; } } Feature2.js(在js文件中智能感知外部js文件的javascript和ASP.NET AJAX)
以下为引用的内容: /// /// // 外部js文件用这种方法引进来 // 控件引入的js用这种方法引进来 function refTest() { // 因为有了“”,所以会感知到Feature.js提供的javascript var m = new window.math(); var v = m.max(x, y); // 因为有了“”,所以会感知到ASP.NET AJAX // $get("testIntellisense"); } WebServiceMath.asmx(为ASP.NET AJAX提供服务的WebService) <%@ WebService Language="C#" Class="WebServiceMath" %> using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; [WebService(Description = "WebService提供的数学函数类", Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.Web.script.Services.scriptService] public class WebServiceMath : System.Web.Services.WebService { /// /// 返回两个整数中的最大的一个 /// /// 需要比较的第一个整数 /// 需要比较的第二个整数 /// [WebMethod(Description = "返回两个整数中的最大的一个")] public int Max(int x, int y) { if (x > y) return x; else return y; } } javascript.aspx 以下为引用的内容: <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="javascript.aspx.cs" Inherits="Feature_javascript" Title="javascript的智能感知和调试(javascript Intellisense and Debugging)" %>
VS 2008可以非常完美地支持javascript和ASP.NET AJAX的智能感知和调试。.NET 3.5内置了ASP.NET AJAX,并且UpdatePanel终于可以支持WebPart了。
|