请CSDN(狼)回答此问题!超级

caobin518 2005-12-18 08:36:15
CSDN狼[今天我在Q中CALL你,你没有应]:

你在
http://community.csdn.net/Expert/topic/4455/4455651.xml?temp=.1300165
中帮我回答了xmlhttp小偷问题.

我没有看懂你的意思 .


我要求是:截取一个页面中的一个表格.


请你提供一个你测试好的程序给我.行吗?
...全文
164 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
超级大笨狼 2005-12-19
  • 打赏
  • 举报
回复
用XMLHTTP就可以把所有的东东都偷过来啦.
<script language="javascript">
function baoGetHTML(url, divTarget)
{
var oHttp = new ActiveXObject("Microsoft.XMLHTTP");
oHttp.open("GET", url, false);
oHttp.send();
SourceCode = bytes2BSTR(oHttp.responseBody);
bao.value = SourceCode;
//bytes2BSTR(oHttp.responseBody)这就是网页的代码.
}
</script>
<script language="vbscript">
Function bytes2BSTR(vIn)
Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
</script>
<input type=button onclick="baoGetHTML(document.all.url.value)" value="Get">
<input type=text value="http://www.baidu.com" name="url">
<textarea id=bao style="width:400;height:300"></textarea>
超级大笨狼 2005-12-19
  • 打赏
  • 举报
回复
<script>
function GetHTML(url)
{
var oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
oXmlHttp.open("GET", url, 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;
Content.value = result;
}
}
</script>
<input type="text" id="url" size="50"><input type="button" onclick="GetHTML(url.value)" value="Get"><br>
<textarea style="width:500;height:500" name="Content"></textarea>
超级大笨狼 2005-12-19
  • 打赏
  • 举报
回复
或者这个:
<script>
adTypeBinary = 1
adSaveCreateOverwrite = 2
adModeReadWrite = 3
xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP")
xmlHTTP.open("GET","http://www.csdn.net/",false)
xmlHTTP.send()
contents = xmlHTTP.responseBody
oStr = new ActiveXObject("ADODB.Stream")
oStr.Mode = adModeReadWrite
oStr.Type = adTypeBinary

oStr.Open()
oStr.Write(contents)
oStr.SaveToFile("d:\\x.htm", adSaveCreateOverwrite)
</script>
超级大笨狼 2005-12-19
  • 打赏
  • 举报
回复
Function bytes2BSTR(vIn) '用于Unicode-16和GB2312的转化
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
超级大笨狼 2005-12-19
  • 打赏
  • 举报
回复
Function getHTTPPage(url) '用于获取来源页面的数据(Text)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=Http.responseText
set http=nothing
if err.number<>0 then err.Clear
End function

Function getHTTPPage_body(url) '用于获取来源页面的数据(Body)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.ContentType=938
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function

if err.number<>0 then err.Clear
getHTTPPage_BODY=bytes2BSTR(Http.responseBody)
set http=nothing

End function
创造奇迹9999 2005-12-19
  • 打赏
  • 举报
回复
当然是那条“超级大笨狼”了
是是非非 2005-12-19
  • 打赏
  • 举报
回复
哪条狼?

看看先
tigerwen01 2005-12-19
  • 打赏
  • 举报
回复
狼已经出现,问题应该解决了吧。
chinastorm 2005-12-19
  • 打赏
  • 举报
回复
study

4,007

社区成员

发帖
与我相关
我的任务
社区描述
它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
社区管理员
  • vbScript社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧