客户端的方式获取某个页面的代码

<script>
    var oXmlHttp = new ActiveXObject("Microsoft.XmlHTTP");
    oXmlHttp.open("GET","http://www.baidu.com", false);
    oXmlHttp.send()
    var oStream = new ActiveXObject("ADODB.Stream");
    if(oStream == null)
        alert("您的机器不支持ADODB.Stream.")
    else
    {
        oStream.Type=1;
        oStream.Mode=3;
        oStream.Open() ;
        oStream.Write(oXmlHttp.responseBody);
        oStream.Position= 0;
        oStream.Type= 2;
        oStream.Charset="gb2312";
        var result= oStream.ReadText();
        oStream.Close();
        oStream = null;
  var aa = window.open("","")
  document.write(result);
        aa.document.write(result);
    }
</script>

posted on 2007-11-17 13:48  Bēniaǒ  阅读(266)  评论(0编辑  收藏  举报