请问VBscript如何实现一个页面获得另一个页面代码?我用WebBrowser1.Navigate 来做,想在本页面上获得另一个页面的代码并在本页面的 textarea中显示出来。可结果显示的都是本页面的代码。代码如下,请高手看一来错在哪里,谢谢!! <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser1 width=0> </OBJECT> <body> <input type="button" name="Command1" id="Command1" value="button"> <textarea name="Text1" cols="100" rows="20" type="text"></textarea> <script language="vbscript">
Private Sub Command1_Click() dim vTag Dim vDoc dim objhtml WebBrowser1.Navigate "http://www.baidu.com" Set vDoc = WebBrowser1.Document Set objhtml = vDoc.body.createtextrange() Text1.value = objhtml.htmltext
For i = 0 To vDoc.All.length - 1
If UCase(vDoc.All(i).tagName) = "INPUT" Then Set vTag = vDoc.All(i) If vTag.value="submit" then vTag.submit end If end If next
End Sub Private Sub WebBrowser1_DocumentComplete() alert("fdasfdsfdsa") Text1.value="xxxxxxxx" End Sub
Command1_Click </script>
</body> </html>