<title>无标题页</title>
<script type="text/vbscript" src="VBScript.vbs"></script>
<script language="javascript" type="text/javascript">
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
function show()
{
xmlhttp.Open("GET","http://www.baidu.com",true)
xmlhttp.onreadystatechange=stateChange;
xmlhttp.Send(null);
}
function stateChange()
{
if(xmlhttp.readystate==4 && xmlhttp.status==200)
{
var data=bytes2BSTR(xmlhttp.ResponseBody);
document.getElementById("div1").innerHTML=data;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btn1" runat="server" Text="tj" OnClientClick="show()" />
</div>
<div id="div1"> </div> </form>
</body>
</html>
<script type="text/vbscript" src="VBScript.vbs"></script>
<script language="javascript" type="text/javascript">
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
function show()
{
xmlhttp.Open("GET","http://www.baidu.com",true)
xmlhttp.onreadystatechange=stateChange;
xmlhttp.Send(null);
}
function stateChange()
{
if(xmlhttp.readystate==4 && xmlhttp.status==200)
{
var data=bytes2BSTR(xmlhttp.ResponseBody);
document.getElementById("div1").innerHTML=data;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btn1" runat="server" Text="tj" OnClientClick="show()" />
</div>
<div id="div1"> </div> </form>
</body>
</html>
document.getElementById("div1").innerHTML=data;=======为何不直接使用 responseText 属性?且不是说你的 bytes2BSTR 函数能否转换成功,对于你直接请求 baidu.com 返回来的数据是整个页面,包含 <html><head> ... 之类的标记,肯定是无法直接通过 div 显示出来的》》》//var data = bytes2BSTR(xmlhttp.ResponseBody);
//document.getElementById("div1").innerHTML = data;
var data=xmlhttp.responseText
var win = window.open();
win.document.write(data);