ajax»ù´¡¶ÁÊé±Ê¼Ç µÚÈýÕ£¨·¢ËÍÇëÇóÓë´¦ÀíÏìÓ¦£©
ͨ¹ýXMLHttpRequest.responseXML;
½«ÏìÓ¦½âÎöΪXML
»ñµÃ¶ÔÏóÓÐÏÂÃæµÄÊôÐԺͷ½·¨
±í3-1 ÓÃÓÚ´¦ÀíXMLÎĵµµÄDOMÔªËØÊôÐÔ
ÊôÐÔÃû
ÃèÊö
childNodes
·µ»Øµ±Ç°ÔªËØËùÓÐ×ÓÔªËصÄÊý×é
firstChild
·µ»Øµ±Ç°ÔªËصĵÚÒ»¸öϼ¶×ÓÔªËØ
lastChild
·µ»Øµ±Ç°ÔªËصÄ×îºóÒ»¸ö×ÓÔªËØ
nextSibling
·µ»Ø½ô¸úÔÚµ±Ç°ÔªËغóÃæµÄÔªËØ
nodeValue
Ö¸¶¨±íʾԪËØÖµµÄ¶Á/дÊôÐÔ
parentNode
·µ»ØÔªËصĸ¸½Úµã
previousSibling
·µ»Ø½ôÁÚµ±Ç°ÔªËØ֮ǰµÄÔªËØ
±í3-2¡¡ÓÃÓÚ±éÀúXMLÎĵµµÄDOMÔªËØ·½·¨
·½·¨Ãû
ÃèÊö
getElementById(id) (document)
»ñÈ¡ÓÐÖ¸¶¨Î©Ò»IDÊôÐÔÖµÎĵµÖеÄÔªËØ
getElementsByTagName(name)
·µ»Øµ±Ç°ÔªËØÖÐÓÐÖ¸¶¨±ê¼ÇÃûµÄ×ÓÔªËصÄÊý×é
hasChildNodes()
·µ»ØÒ»¸ö²¼¶ûÖµ£¬Ö¸Ê¾ÔªËØÊÇ·ñÓÐ×ÓÔªËØ
getAttribute(name)
·µ»ØÔªËصÄÊôÐÔÖµ£¬ÊôÐÔÓÉnameÖ¸¶¨
ÏÂÃæ¿´Ò»¸öʵÀý
ÃæµÄÀý×Ó¿ÉÒÔ¿´µ½£¬Ê¹ÓÃ×ñÑW3C DOMµÄJavaScriptÀ´¶ÁÈ¡XMLÎĵµÊǺεȼòµ¥¡£´úÂëÇåµ¥3-3ÏÔʾÁË·þÎñÆ÷Ïòä¯ÀÀÆ÷·µ»ØµÄXMLÎĵµµÄÄÚÈÝ¡£ÕâÊÇÒ»¸ö¼òµ¥µÄÃÀ¹úÖÝÃûÁÐ±í£¬¸÷¸öÖÝ°´µØÇø»®·Ö¡£
´úÂëÇåµ¥3-3 ·þÎñÆ÷·µ»ØµÄÃÀ¹úÖÝÃûÁбí
ÕâÀïÊǸöxml
<?xml version="1.0" encoding="UTF-8"?>
<states>
<north>
<state>Minnesota</state>
<state>Iowa</state>
<state>North Dakota</state>
</north>
<south>
<state>Texas</state>
<state>Oklahoma</state>
<state>Louisiana</state>
</south>
<east>
<state>New York</state>
<state>North Carolina</st
Ïà¹ØÎĵµ£º
ºìÉ«×ÖÌåΪÖ÷Òª´úÂë
jspÒ³ÃæÖÐ
<script language="javascript">
function updateDB(operate){
var objDom=new ActiveXObject("msxml.DomDocument");
var objRoot=objDom.createElement("All");
objDom.appendChild(objRoot);
var k=document.ge ......
¹ØÓÚajaxµÄÃû×Ö
ajax µÄÈ«³ÆÊÇAsynchronous JavaScript and XML£¬ÆäÖУ¬Asynchronous ÊÇÒì²½µÄÒâ˼£¬ËüÓбðÓÚ´«Í³web¿ª·¢ÖвÉÓõÄͬ²½µÄ·½Ê½¡£
¹ØÓÚͬ²½ºÍÒì²½
Òì²½´«ÊäÊÇÃæÏò×Ö·ûµÄ´«Ê䣬ËüµÄµ¥Î»ÊÇ×Ö·û£»¶øͬ²½´«ÊäÊÇÃæÏò±ÈÌصĴ«Ê䣬ËüµÄµ¥Î»ÊÇè壬Ëü´«ÊäµÄʱºòÒªÇó½ÓÊÜ·½ºÍ·¢ËÍ·½µÄʱÖÓÊ ......
±ÈÈçÒª¸øÓû§±¨¸æÒ»¸ö´íÎó£¬ÓÃÏÂÃæµÄ·½·¨£º
ʹÓÃset_error_handlerÉèÖÃ×Ô¼ºµÄ´íÎó´¦Àíº¯Êý£¬ÔÚ±¨´íµÄµØ·½Ê¹ÓÃtrigger_error£¬ÔÚ×Ô¶¨ÒåµÄ´íÎó´¦Àíº¯ÊýÖиøÓû§ÏÔʾһ¸ö³ö´íÐÅÏ¢Ò³Ãæ¡£
µ«
ÊÇÈç¹ûµ÷ÓÃtrigger_errorµÄÕâ¸öÒ³ÃæÊDZ»Ò»´ÎajaxÇëÇó´¥·¢µÄ£¬ÄÇôajax·µ»Øºó½«µÃµ½Ò»´ó¶ÑÓÃÓÚÏÔʾ´íÎóµÄhtml´úÂë¡£¶øÒ»°ã
ajaxµ÷Óö ......
1£ºAjax¿ÉÒÔͨ¹ýJavaScriptµÄXMLHttpRequest¶ÔÏóÓë·þÎñÆ÷½øÐÐͨÐÅ£¬Í¨¹ýXMLHttpRequest£¬JavaScript¿ÉÒÔÔÚ²»ÖØÔØÒ³ÃæµÄÇé¿öÏÂÓë·þÎñÆ÷½øÐÐͨÐÅ¡£
2£ºXMLHttpRequest ä¯ÀÀÆ÷Ö§³Ö
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
xmlHtt ......
ajax.asp
ÏÖÔÚʱ¼äÊÇ< %=Now()%>
ajax.html
<script type="text/javascript">
function Ajax(){
var xmlHttp=null;
if(window.ActiveXObject){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
......