AJAX Ó¦ÓÃ
<script type="text/javascript">
function addUrl(){
//1¡¢ÉèÖÃÇëÇóurlµØÖ·
var name = document.getElementById("name").value;
var text = document.getElementById("url").value;
var url = "insertUrl.do?name="+name+
"&url="+text+"&time"+new Date() ;
//2¡¢´´½¨xmlHttpRequest¶ÔÏó
xmlHttpRequest = createXmlHttpRequest();
//3¡¢ÉèÖÃxmlHttpRequest¶ÔÏóµÄ»Øµ÷º¯Êý
xmlHttpRequest.onreadystatechange = execute ;
//4¡¢×¢²áxmlHttpRequest¶ÔÏó
xmlHttpRequest.open("get",url,true);
//5¡¢·¢ËÍÇëÇó
xmlHttpRequest.send(null);
}
//´´½¨xmlHttpRequest¶ÔÏó·½·¨
function createXmlHttpRequest(){
//Èç¹ûÊÇIEä¯ÀÀÆ÷
if(window.ActiveXObject){
return new ActiveXObject("Microsoft.XMLHTTP");
}
//·ÇIEä¯ÀÀÆ÷
if(window.XMLHttpRequest){
return new XMLHttpRequest();
}
}
//»Øµ÷º¯Êý
function execute(){
//µ±xmlHttpRequestµÄ״̬Ϊ½ÓÊÕ½á¹û²¢Íê±ÏºÍ·þÎñÆ÷·µ»Ø״̬ΪÕý³£Ö´ÐÐˢв¿·ÖÒ³Ãæ
if(xmlHttpRequest.readyState == 4 &&
xmlHttpRequest.status == 200){
if(xmlHttpRequest.responseText=="true"){
alert("Ìí¼Ó³É¹¦£¡");
//Ìí¼Óµ½ÏÂÀÁбí
var obj = document.getElementById("myUrl");
var name =
document.getElementById("name").value;
var text =
document.getElementById("url").value;
var op = new Option(name,text);
obj.options.add(op);
//Òþ²Ø²ã
showAddUrl();
}
}
}
½âÎöXML·µ»ØµÄÀý×Ó
//»Øµ÷º¯Êý
function execute(){
//µ±xmlHttpRequestµÄ״̬Ϊ½ÓÊÕ½á¹û²¢Íê±ÏºÍ·þÎñÆ÷·µ»Ø״̬ΪÕý³£Ö´ÐÐˢв¿·ÖÒ³Ãæ
if(xmlHttpRequest.readyState == 4 &&
xmlHttpRequest.status == 200){
alert("Ìí¼Ó³É¹¦£¡");
//Ìí¼Óµ½ÏÂÀÁбí
var obj = document.getElementById("myUrl");
//Ìí¼Ó֮ǰÏÈÇå¿ÕÁбí
obj.options.length = 0 ;
//»ñÈ¡xmlHttpRequest·µ»ØµÄxml¶ÔÏó
(ÀûÓÃJavaScriptµÄDOMÄ£Ðͽ«´Ëxml½âÎö³öÀ´)
xmlDoc = xmlHttpRequest.responseXml;
//»ñÈ¡¸ù½Úµã
myUrl = xmlDoc.documentElement ;
//Ñ»·±éÀú¸ù½ÚµãµÄËùÓÐ×Ó½Úµã
for(var x=0;x<myUrl.childNodes.length;x++){
m
Ïà¹ØÎĵµ£º
3.4Àí½â¼Ì³Ð
Ò»£®»ùÓÚÔÐ͵ļ̳Уº
²½Ö裺
(1)ÔÚ×ÓÀ๹Ô캯ÊýÖе÷ÓûùÀ๹Ô캯Êý£¬´Ó¶ø¼Ì³Ð»ùÀàµÄÊôÐÔ¡£
(2)½«»ùÀàµÄÒ»¸öÐÂʵÀý¸³¸ø×ÓÀ࣬´Ó¶ø¼Ì³Ð»ùÀàµÄ·½·¨¡£
Samples.Cat=function()
{
Samples.Pet.call(this);
}
Sample ......
×î½üµÄÏîÄ¿ÀïÓõ½AjaxControlToolkit 3.5,ÏîÄ¿Íê³ÉÒÔºóÔÚ±¾µØ²âÊÔûÎÊÌ⣬·Åµ½·þÎñÆ÷ÉÏÈ¥ÔÚIE6¾Í³öÏÖAjax ¿Í»§¶Ë¿ò¼ÜδÄܼÓÔصÄÎÊÌ⣬ÔÚFF£¬IE7£¬Opera£¬SafariµÈä¯ÀÀÆ÷¶¼Ã»ÎÊÌ⣬ÕæÊǸ㲻¶®MSÔõô¸ãµÃ£¬ÏÖÔÚ ¾ÍÏëÅ×ÆúIE6£¬ÕҵĺÃÐÁ¿à°¡£¬ÍøÉÏ˵µÄ½â¾ö·½°¸¶¼ÊÔ¹ýÁË£¬¶¼Ã»Óã¬×îºóÕÒµ½µÄ´ð°¸ÊÇ£ºÓ¦ÓóÌÐòµÄ±àÂëÎÊ Ì⣬ֻҪÔÚ ......
2.1Microsoft Ajax LibraryËÙÀÀ£º
Microsoft Ajax LibraryÊÇÒ»×é¿ÉÒÔä¯ÀÀÆ÷¶Ë¶ÀÁ¢ÔËÐеÄJavaScriptº¯Êý¿â£¬°üº¬ÍøÒ³ºËÐÄ·þÎñÒÔ¼°Ìṩä¯ÀÀÆ÷µÄXMLÔ¶³ÌÊý¾Ý´æÈ¡ÄÜÁ¦¡£
Ö§³ÖµÄä¯ÀÀÆ÷ÓУºIE¡¢Mozilla¡¢Firefox¡¢Apple Safari¡£
2.1.2ÔÚASP.NETÒ³ÃæÖÐÔö¼ÓAjaxÖ§³Ö
Ajax LibraryÊÇרΪAjax¹¦ÄÜÌṩµÄScript£¬ËüÊ ......
µÚËÄÕ Ajax·þÎñÆ÷À©Õ¹ÆÊÎö
Ajax·þÎñÆ÷À©Õ¹£ºASP.NET Ajax¿ò¼ÜµÄ·þÎñÆ÷¶Ë¡£
4.1ASP.NET ¿ª·¢ÈËÔ±µÄAjax
Ϊ·þÎñÆ÷¶Ë¿ª·¢ÌṩAjaxÖ§³Ö¡£°üÀ¨Ò»×éеķþÎñÆ÷¿Ø¼þºÍ·þÎñ£¬ÓÃÀ´ÃþÄâ¿Í»§¶ËAjaxÐÐΪ¡£
4.2¸Ä½øÔÓÐASP.NETÍøÕ¾
(1)¸ÄÉÆÍøÂçÑÓ³Ù£º¾¡×î´ó¿ÉÄܼõÉÙä¯ÀÀÆ÷ºÍ·þÎñÆ÷Ö®¼ä´«µÝµÄÊý¾ÝÁ¿¡£
(2)Ïû³ýȫҳà ......
//==================>¡¾index.jsp¡¿===============================
<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<% String path=request.getContextPath(); %>
<%@page import="com.sinoest.dfrf.orm.pojo.Mainmenu"%>
<%@page import="com.si ......