国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP ?? ?? ???? ?? ??

1. ?? ??? ?? ??

??? ??? ???? XMLHttpRequest ??? responseText ?? responseXML ??? ??? ? ????.


66.png

2. responseText ??

?? ??? XML? ?? ?? responseText ??? ??????.

responseText ??? ??? ???? ????? ??? ?? ??? ? ????.

4_1.php? ???? 4_2.txt?? ??? ????.

4_1.php ??

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","4_2.txt",true);
xmlhttp.send();
}
</script>
</head>
<body>
<h2>AJAX</h2>
<button type="button" onclick="loadXMLDoc()">通過AJAX改變內(nèi)容</button>
<div id="myDiv">AJAX</div>
</body>
</html>

4_2.txt ??

* AJAX 是一種用于創(chuàng)建快速動態(tài)網(wǎng)頁的技術(shù)。

3.responseXML ??

??? ??? XML?? XML ??? ?? ???? ?? ?? responseXML ??? ?????.

4_4.xml ??? ???? ??? ?? ?????(???? ??? , ? ????. 4_3.php ???? ?? ???? ?? 4_4.xml )? ?? ???? ????.

4_3.php ??

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
function loadXMLDoc()
{
var xmlhttp;
var txt,x,i;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    xmlDoc=xmlhttp.responseXML;
    txt="";
    x=xmlDoc.getElementsByTagName("title");
    for(i=0;i<x.length;i++){
    		txt=txt+x[i].childNodes[0].nodeValue+"<br/>";
    	}
    document.getElementById("myDiv").innerHTML=txt
    }
  }
xmlhttp.open("GET","4_4.xml",true);
xmlhttp.send();
}
</script>
</head>
<body>
<h2>AJAX</h2>
<button type="button" onclick="loadXMLDoc()">通過AJAX改變內(nèi)容</button>
<div id="myDiv">AJAX</div>
</body>
</html>

4_4.xml ??

<!--  Copyright  php.cn -->
<bookstore>
<book category="children">
<title>Harry Potter</title
><author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="cooking">
<title>Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="web" cover="paperback">
<title>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book><book category="web">
<title>XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
</bookstore>
???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> function loadXMLDoc() { var xmlhttp; var txt,x,i; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { xmlDoc=xmlhttp.responseXML; txt=""; x=xmlDoc.getElementsByTagName("title"); for(i=0;i<x.length;i++){ txt=txt+x[i].childNodes[0].nodeValue+"<br/>"; } document.getElementById("myDiv").innerHTML=txt } } xmlhttp.open("GET","4_4.xml",true); xmlhttp.send(); } </script> </head> <body> <h2>AJAX</h2> <button type="button" onclick="loadXMLDoc()">通過AJAX改變內(nèi)容</button> <div id="myDiv">AJAX</div> </body> </html>