0
function somefunction()
{
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)
{
alert(xmlhttp.responseText.getElementById('someid').innerHTML);
}
}
xmlhttp.open("GET","1.php",true);
xmlhttp.send();
}
从XMLHTTP反应是这个是否有可能从responsetext获取元素,而不是先打印出来?
<p id="someid">100</p>
我需要得到 “100” 出来自ID为 “someid”
使用该
alert(xmlhttp.responseText.getElementById('someid').innerHTML);
,但它不试图没有工作。
还有另外一种方法吗?
在此先感谢