標籤:style blog http color io java ar for sp
AJAX庫支援命名空間的概念。 類可以分組到不同的命名空間。AJAX庫會自動建立在此層次中不存在的任何層級的命名空間。
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ASPNETAJAXNamespaces.aspx.cs" Inherits="ASPNETAJAXNamespaces" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>ASP.NET AJAX Namespaces</title> <script type="text/javascript"> function pageLoad(sender, args) { Type.registerNamespace(‘Wrox.AspAjax.Samples‘); alert(Type.isNamespace(Wrox.AspAjax)); //displays ‘true‘ alert(Type.isNamespace(Wrox.AspAjax.Samples)); // displays ‘false‘ var namespaces = Type.getRootNamespaces(); for(var i = 0, length=namespaces.length; i<length; i++) { alert(namespaces[i].getName()); // displays ‘Sys‘ and ‘Wrox‘ } } </script></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> </div> </form></body></html>
Type.getRootnamespaces()函數會得到全域命名空間組。
ASP.NET AJAX註冊命名空間