用XMLHTTP和ADODB.oStream可以很方便地得到一个Url地址的源代码。而且效率高。
1<script>
2 var oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
3 oXmlHttp.open("GET","http://dotnet.aspx.cc/content.aspx", false);
4 oXmlHttp.send()
5 var oStream = new ActiveXObject("ADODB.Stream");
6 if(oStream == null)
7 alert("您的机器不支持ADODB.Stream.")
8 else
9 {
10 oStream.Type=1;
11 oStream.Mode=3;
12 oStream.Open() ;
13 oStream.Write(oXmlHttp.responseBody);
14 oStream.Position= 0;
15 oStream.Type= 2;
16 oStream.Charset="gb2312";
17 var result= oStream.ReadText();
18 oStream.Close();
19 oStream = null;
20 alert( result);
21 }
22</script>
23
24
2 var oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
3 oXmlHttp.open("GET","http://dotnet.aspx.cc/content.aspx", false);
4 oXmlHttp.send()
5 var oStream = new ActiveXObject("ADODB.Stream");
6 if(oStream == null)
7 alert("您的机器不支持ADODB.Stream.")
8 else
9 {
10 oStream.Type=1;
11 oStream.Mode=3;
12 oStream.Open() ;
13 oStream.Write(oXmlHttp.responseBody);
14 oStream.Position= 0;
15 oStream.Type= 2;
16 oStream.Charset="gb2312";
17 var result= oStream.ReadText();
18 oStream.Close();
19 oStream = null;
20 alert( result);
21 }
22</script>
23
24