先看看教程,任何找个例子好好看看再试吧。

解决方案 »

  1.   

    我这有现成的代码!!!........ 你试试吧!!!
    //xmlHttprequest对象
    var xmlHttp=false;
    //创建xmlHttp对象
    //需要针对IE和其他类型建立的这个对象的不同方式写不同的代码
    try{
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
    try{
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }catch(e2){
    xmlHttp=false;
    }
    }
    /* 处理 Mozilla 和非 Microsoft 浏览器 */
    if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
    }
    if(!xmlHttp){
    alert('服务对象创建失败!');
    }