Ajax add_initializeRequest
<%@ 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>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="BtnCommon" runat="server" Text="Common" onclick="Btn_Click" />
<br />
<asp:Button ID="btnPrecedence" runat="server" onclick="Btn_Click"
Text="Precedence" />
<br />
<asp:Label ID="lblmsg" runat="server" ForeColor="#FF3300"></asp:Label>
<hr>
<div id="divAsyncmsg"></div>
</ContentTemplate>
</asp:UpdatePanel>
<mce:script language="javascript" type="text/javascript"><!--
function ShowMsg(showmsg) {
var divAsyncmsg = $get("divAsyncmsg");
divAsyncmsg.innerHTML = showmsg; //ÏÖʵÐÅÏ¢
window.setTimeout(function() { divAsyncmsg.innerHTML=" "}, 3000);//ÈýÃëÖÓºóÇå¿Õ
}//Òì²½ÐÅϢչʾ
var BtnPrecedenceID = "<%=this.btnPrecedence.ID %>";//»ñÈ¡ÓÅÏȼ¶µÄ°´Å¥ID
var BtnLastpostBackID = null;//ÉêÃ÷×îºóÒ»´ÎÇëÇó¡£
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(
function(sender, e) {
var prm = Sys.WebForms.PageRequestManager.getInstance();//»ñÈ¡Ò³ÃæÇëÇóʵÀý¡£
if (
Ïà¹ØÎĵµ£º
Ò»¡¢°×»°AjaxµÄÔÀí
Õâ¸öÆäʵҪ´ÓC/SºÍB/SµÄÔÀí˵Æð¡£Windows²Ù×÷ϵͳµÄµ®Éú£¬Îªµ¥»úͨÐÅÌṩÁ˺ܴóµÄÖ§³Ö£¬³ÌÐòÉè¼ÆÒ²´ÓDOSÔçÆڵĵ¥ÈÎÎñµ¥Óû§ÏòÍøÂçµÄ·Ö²¼Ê½Ó¦Óùý¶È¡£C/SÌṩµÄ¿Í»§/·þÎñÆ÷±à³ÌģʽΪÍøÂçÓ¦ÓÃÌṩÁËÒ»¸öÓÐЧµÄͨÐÅÊֶΡ£ä¯ÀÀÆ÷ÓëWeb·þÎñÆ÷Ö®¼äµÄÇëÇó/ ·þÎñ£¬¾ÍÊ ......
ËÄ¡¢³£¼ûAjax±à³Ì¿ò¼Ü
¼ÈÈ»ÉÏÊöAjax¿ò¼ÜÒѾÄܹ¤×÷ÁË£¬ÎªÊ²Ã´»¹ÓÐÄÇô¶àµÄ¿ò¼ÜÄØ£¿
Ëæ×ÅÒ³ÃæµÄ¸´ÔÓ£¬¿ÉÄÜÐèÒªÊéд´óÁ¿µÄJavascript½Å±¾À´¶ÔÒ³ÃæÖеÄDOM¶ÔÏó½øÐпØÖÆ£¬¹¤×÷Á¿ºÍ¸´ÔӶȻá´ó´óÔö¼Ó¡£Ajax±à³Ì¿ò¼Üͨ³£ÀûÓÃÃæÏò¶ÔÏóµÄ·½·¨£¬¶ÔһЩ»ù±¾µÄ¶ÔÏóºÍÐÐΪ¼° ......
XMLHttpRequest ¶ÔÏóÊÇAJAX¹¦ÄܵĺËÐÄ£¬Òª¿ª·¢AJAX³ÌÐò±ØÐë´ÓÁ˽âXMLHttpRequest ¶ÔÏó¿ªÊ¼¡£
¡¡¡¡Á˽âXMLHttpRequest ¶ÔÏó¾ÍÏÈ´Ó´´½¨XMLHttpRequest ¶ÔÏó¿ªÊ¼£¬ÔÚ²»Í¬µÄä¯ÀÀÆ÷Öд´½¨XMLHttpRequest ¶ÔÏóʹÓò»Í¬µÄ·½·¨£º
¡¡¡¡ÏÈ¿´¿´IE´´½¨XMLHttpRequest ¶ÔÏóµÄ·½·¨(·½·¨1)£º
¡¡¡¡var xmlhttp = new ActiveXObject(" ......
ǰ̨£º
<html>
<head>
<title>AjaxʵÏÖÎÞË¢ÐÂÈýÁª¶¯ÏÂÀ¿ò</title>
<SCRIPT language="javascript">
......
ÒÔÏÂÒýÓÃ×Ô MSDN Magazine:
²»Âۺûµ£¬UpdatePanel ¿Ø¼þ¶¼ÊÇ ASP.NET AJAX ÉçÇøËùϲ°®µÄ¡£ÎÒ˵“ºÃ”£¬ÊÇÒòΪ UpdatePanel ʹ²¿·ÖÒ³Ãæ³ÊÏÖ±äµÃÏ൱¼òµ¥£¬¶ø˵“»µ”£¬ÊÇÒòΪËüµÄ¼ò±ãºÍÒ×ÓÃÐÔÊÇÒÔЧÂʺÍÁîÈËÌäЦ½Ô·ÇµÄ´ø¿íΪ´ú¼ÛµÄ¡£
UpdatePanel ¿ÉÒÔΪһ°ãµÄÍøÒ³´øÀ´ AJAX ÉñÆæµÄºÃ´¦£¬µ«ÊÇËü²»ÄÜÌá ......