其实就是用XMLHTTP来做!
没什么新鲜的,看过的就不用贬我了
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<style>
#HtmlContent
{
background:#ddd;
font:9pt bold;
color:#000;
}
</style>
</HEAD>
<BODY>
http://<input type="text" id="HttpUrl" value="在这里输入目标Url">
<button id="btnSubmit">查看</button>
<select id="SubMethod">
<option value="POST">POST</option>
<option value="GET">GET</option>
</select>
<Div id="HtmlContent"></Div>
</BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
function GetSource( url, DestObj, OpenMethod )
{
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
with( xmlhttp )
{
try
{
onreadystatechange = function(){
if( readyState == 4 )
{
if( status == 200 )
{
DestObj.innerText = Bytes2BSTR( responseBody );
if( responseText == "" )
{
DestObj.innerText = "无效的加载";
}
}
else
{
DestObj.innerText = "对不起,加载错误!";
}
}
else
{
DestObj.innerText = "加载中";
}
}
open(OpenMethod, "http://" + url + (/\?/g.test(url) ? "&" : "?") + "dsclub=" + Math.random(), true);
send();
}
catch(ex)
{
DestObj.innerText = "加载错误!";
}
}
}
function HttpUrl.onmouseover()
{
var Obj = event.srcElement;
Obj.focus();
Obj.select();
}
function btnSubmit.onclick()
{
GetSource( HttpUrl.value, HtmlContent, SubMethod.value );
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="VBScript">
Function Bytes2BSTR( vIn )
Dim strReturn
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>
</HTML>
<HTML>
<HEAD>
<style>
#HtmlContent
{
background:#ddd;
font:9pt bold;
color:#000;
}
</style>
</HEAD>
<BODY>
http://<input type="text" id="HttpUrl" value="在这里输入目标Url">
<button id="btnSubmit">查看</button>
<select id="SubMethod">
<option value="POST">POST</option>
<option value="GET">GET</option>
</select>
<Div id="HtmlContent"></Div>
</BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
function GetSource( url, DestObj, OpenMethod )
{
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
with( xmlhttp )
{
try
{
onreadystatechange = function(){
if( readyState == 4 )
{
if( status == 200 )
{
DestObj.innerText = Bytes2BSTR( responseBody );
if( responseText == "" )
{
DestObj.innerText = "无效的加载";
}
}
else
{
DestObj.innerText = "对不起,加载错误!";
}
}
else
{
DestObj.innerText = "加载中";
}
}
open(OpenMethod, "http://" + url + (/\?/g.test(url) ? "&" : "?") + "dsclub=" + Math.random(), true);
send();
}
catch(ex)
{
DestObj.innerText = "加载错误!";
}
}
}
function HttpUrl.onmouseover()
{
var Obj = event.srcElement;
Obj.focus();
Obj.select();
}
function btnSubmit.onclick()
{
GetSource( HttpUrl.value, HtmlContent, SubMethod.value );
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="VBScript">
Function Bytes2BSTR( vIn )
Dim strReturn
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>
</HTML>
对看到的代码自己分析吧,对着代码想干什么都行了!
这个主要是对付那种
使用JS什么来跳转页面的页面,尤其是一些试听MP3的网站!
只是探讨技术,每别的什么启发:
不过responseBody这个倒霉东西返回一个Variant,用JS怎么也搞不定!还得用VBS来做!服了!