ajax.jsvar xmlHttp;
function S_xmlhttprequest()
{
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
}
elseif(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}}function funajax(url)
{
S_xmlhttprequest();
xmlHttp.open("GET","Ajaxtest.php?id="+url,true);
xmlHttp.onreadystatechange = byphp;
xmlHttp.send(null);
}function byphp()
{
var byphpresult = xmlHttp.responseText;
document.getElementById('aaa').innerHTML = byphpresult;
}ajaxtest.php<?php
if($id = $_GET[id])
{
for($i=1;$i<10;$i++)
{
echo $id;
}}
exit();
?>
index.php<?php?>
 <script type = "text/javascript" src= "ajax.js"></script>
 <a href="#" onclick = "funajax('o')">o</a>
 <a href="Ajaxtest.php?id=t">t</a>
 <a href="Ajaxtest.php?id=x">x</a>
 <div id = "aaa"></div>

解决方案 »

  1.   

    有什么提示?最好用浏览器调试工具嗯,elseif(window.XMLHttpRequest)改为else if
      

  2.   

    当然不行!
    <a href="#" onclick = "funajax('o')">o</a>
    点击后将产生新页面你可以
    <span onclick = "funajax('o')">o</span>

    <input type=button value='o' onclick = "funajax('o')">

    <div onclick = "funajax('o')">o</div>
    等等
      

  3.   

    连xmlHttp都是没有,还谈什么更新啊