XMLHttps
难得的是页面里面一个 table 也没有....而且居然在 FF 底下看还不会变形,哦哈哈哈
直接运行的话 URL 只能填本域的,如果遇到安全性限制,代码 copy 到本地保存为 hta 运行
XMLHttps
* { font-size:13px; line-height:13px; font-family:"Comic Sans MS" Arial 宋体; color:#333; padding:0px; margin:0px; }
body { background-color:buttonface; overflow:auto; border-style:none; padding:0px 15px; text-align:center; }
fieldset { margin:7px 0px; }
legend { font-weight:bold; font-size:14px; }
input { height:16px; line-height:14px; }
.text { height:16px; border:1px solid #333; font-size:12px; line-height:14px; padding:0px 5px; }
.settingLabel { width:120px; padding:0px 10px; height:16px; line-height:16px; display:block; float:left; }
.settingLabel2 { width:118px; padding:0px 10px; height:16px; line-height:16px; float:left; }
.label01 { width:90px; }
.floatLeft { float:left; }
.button01 { border:1px solid #666; color:#555; height:20px; line-height:16px; text-align:center; padding:0px 10px; text-decoration:none; margin-left:10px; }
#divMain { width:740px; margin:0px auto; position:relative; text-align:left; }
#txtURL { width:590px; }
#divHeaders { width:735px; height:90px; float:left; }
#outerSelectHeaders, #outerSelectItems { border:1px solid #333; overflow:hidden; position:absolute; margin:4px; }
#selectHeaders, #selectItems { width:220px; height:80px; margin:-3px -3px -5px -3px; }
#divHeadersSetting, #divItemsSetting { margin-left:360px; }
#txtHeaderName, #txtHeaderValue, #txtItemName, #txtItemValue { width:230px; }
#txtItemValue { height:35px; overflow:auto; padding:3px; border:1px solid #333; }
#divSending { height:120px; }
#divSendingData2 { display:none; }
#txtSendingData, #txtResponseHeader, #txtResponseBody { width:590px; height:80px; overflow:auto; border-width:1px; padding:3px; }
#divReadyState, #divStatus { margin:0px 50px 0px 2px; background-color:green; color:white; padding:0px 20px; float:left; display:block; }
/***************
* Global Variable Defintion
* Author: Hutia
**/
var cmdAddModifyHeader, cmdAddModifyItem, cmdCreateThread, cmdDelHeader, cmdDelItem, cmdSend, cmdViewResponse, divReadyState, divSendingData1;
var divSendingData2, divStatus, divThreads, radioInputType1, radioInputType2, radioMethodGet;
var radioMethodPost, selectHeaders, selectItems, txtHeaderName, txtHeaderValue;
var txtItemName, txtItemValue, txtResponseHeader, txtResponseBody, txtSendingData, txtURL;
var xmlhttps=new Array();
var curThread;
var glbEncode=new Array();
//**检测浏览器种类*****
var BROWSERNAME="";
switch(navigator.appName.toLowerCase()){
case "netscape":
BROWSERNAME="ns";
break;
case "microsoft internet explorer":
default:
BROWSERNAME="ie";
break;
}
// init function for window.onload
function init(){
// init the window size
fixSize();
//window.onresize=fixSize;
// init all the global object variable for compatibility
cmdAddModifyHeader=document.getElementById("cmdAddModifyHeader");
cmdAddModifyItem=document.getElementById("cmdAddModifyItem");
cmdCreateThread=document.getElementById("cmdCreateThread");
cmdDelHeader=document.getElementById("cmdDelHeader");
cmdDelItem=document.getElementById("cmdDelItem");
cmdSend=document.getElementById("cmdSend");
cmdViewResponse=document.getElementById("cmdViewResponse");
divReadyState=document.getElementById("divReadyState");
divSendingData1=document.getElementById("divSendingData1");
divSendingData2=document.getElementById("divSendingData2");
divStatus=document.getElementById("divStatus");
divThreads=document.getElementById("divThreads");
radioInputType1=document.getElementById("radioInputType1");
radioInputType2=document.getElementById("radioInputType2");
radioMethodGet=document.getElementById("radioMethodGet");
radioMethodPost=document.getElementById("radioMethodPost");
selectHeaders=document.getElementById("selectHeaders");
selectItems=document.getElementById("selectItems");
txtHeaderName=document.getElementById("txtHeaderName");
txtHeaderValue=document.getElementById("txtHeaderValue");
txtItemName=document.getElementById("txtItemName");
txtItemValue=document.getElementById("txtItemValue");
txtResponseHeader=document.getElementById("txtResponseHeader");
txtResponseBody=document.getElementById("txtResponseBody");
txtSendingData=document.getElementById("txtSendingData");
txtURL=document.getElementById("txtURL");
// init all the events for elements
cmdAddModifyHeader.onclick=function(){setHeader();thread_setAttribute("headers",headers_select2array());return(false);}
cmdAddModifyItem.onclick=function(){setItem();txtSendingData.value=items_select2string();thread_setAttribute("requestData",txtSendingData.value);return(false);}
cmdDelHeader.onclick=function(){delHeader();thread_setAttribute("headers",headers_select2array());return(false);}
cmdDelItem.onclick=function(){delItem();txtSendingData.value=items_select2string();thread_setAttribute("requestData",txtSendingData.value);return(false);}
cmdAddModifyHeader.onmouseover=cmdAddModifyItem.onmouseover=cmdCreateThread.onmouseover=cmdDelHeader.onmouseover=cmdDelItem.onmouseover=cmdSend.onmouseover=cmdViewResponse.onmouseover=function(){this.style.backgroundColor="#E0E0E0";}
cmdAddModifyHeader.onmouseout=cmdAddModifyItem.onmouseout=cmdCreateThread.onmouseout=cmdDelHeader.onmouseout=cmdDelItem.onmouseout=cmdSend.onmouseout=cmdViewResponse.onmouseout=function(){this.style.backgroundColor="";}
cmdCreateThread.onclick=createThread;
cmdSend.onclick=function(){
curThread=parseInt(curThread);
if(isNaN(curThread))return;
if(!xmlhttps[curThread])return;
if(!xmlhttps[curThread].client)return;
xmlhttps[curThread].resultTreated=false;
xmlhttps[curThread].client.open(xmlhttps[curThread].method,xmlhttps[curThread].url+(xmlhttps[curThread].url.indexOf("?")==-1?"?":"&")+uid()+"="+uid(),true);
for(var i=0;ifunction killErrors() {return true;}window.onerror = killErrors;"+txtResponseBody.value);
newWin.document.close();
}catch(e){}
}
radioInputType1.onfocus=radioInputType1.onclick=function(){
if(this.checked&&divSendingData1.style.display=="none"){
switchInputType(true);
thread_setAttribute("dataType",this.value);
}
}
radioInputType2.onfocus=radioInputType2.onclick=function(){
if(this.checked&&divSendingData2.style.display=="none"){
switchInputType(false);
thread_setAttribute("dataType",this.value);
}
}
radioMethodGet.onfocus=function(){if(this.checked)thread_setAttribute("method",this.value);}
radioMethodPost.onfocus=function(){if(this.checked)thread_setAttribute("method",this.value);}
selectHeaders.onchange=selectHeaders.onclick=showHeader;
selectItems.onchange=selectItems.onfocus=showItem;
txtSendingData.onchange=function(){thread_setAttribute("requestData",this.value);}
txtURL.onchange=function(){
if(!this.value.match(/^http:\/\//i))this.value="http://"+this.value;
thread_setAttribute("url",this.value);
}
// init timer
setInterval(refreshStatus,200);
// init action
createThread();
loadThread(0);
addHeader("Content-Type","application/x-www-form-urlencoded");
addItem("UserName","Hutia");
}
// function for window resizing
function fixSize(){
try{
top.resizeTo(screen.availWidth-2,screen.availHeight-2);
top.moveTo(1,1);
}catch(e){setTimeout(fixSize);}
}
/***************
* Some Functional functions
* Author: Hutia
**/
function addHeader(headerName,headerValue){
if(headerName=="")return;
for(var i=0;i
function addItem(itemName,itemValue){
if(itemName=="")return;
for(var i=0;i
function createThread(){
var index, oRadio, oLabel;
index=xmlhttps.length;
xmlhttps[index]=new Object();
xmlhttps[index].client=getXMLRequester();
xmlhttps[index].headers=new Array();
xmlhttps[index].url="http://";
xmlhttps[index].method="get";
xmlhttps[index].id=uid();
xmlhttps[index].dataType="Name-Value";
xmlhttps[index].requestData="";
xmlhttps[index].responseHeaders="";
xmlhttps[index].responseText="";
xmlhttps[index].resultTreated=false;
if(!xmlhttps[index].client){alert("创建进程失败,请检查安全设置。");return(false);}
if(BROWSERNAME=="ie"){
oRadio=document.createElement("");
}else{
oRadio=document.createElement("input");
oRadio.type="radio";
oRadio.name="radioThreads";
oRadio.checked=true;
}
oRadio.id=xmlhttps[index].id;
oRadio.value=index;
oRadio.onclick=oRadio.onfocus=function(){
if(this.checked&&curThread!=this.value){loadThread(this.value);};
}
oLabel=document.createElement("label");
oLabel.htmlFor=oRadio.id;
oLabel.innerHTML="进程"+(index+1);
divThreads.appendChild(oRadio);
divThreads.appendChild(oLabel);
}
function delHeader(){
var index=selectHeaders.selectedIndex;
if(index=selectHeaders.options.length)index--;
if(index-1)selectHeaders.options[index].selected=true;
showHeader();
}
function delItem(){
var index=selectItems.selectedIndex;
if(index=selectItems.options.length)index--;
if(index-1)selectItems.options[index].selected=true;
showItem();
}
function headers_array2select(ary){
while(selectHeaders.options.length>0)selectHeaders.options[0]=null;
for(var i=0;i
function headers_select2array(){
var ary=new Array();
for(var i=0;i
function items_select2string(){
var str="";
for(var i=0;i
function items_string2select(str){
var ary=str.split("&");
while(selectItems.options.length>0)selectItems.options[0]=null;
for(var i=0;i
function loadThread(threadID){
var radios;
if(threadID!=null&&threadID!=undefined&&!isNaN(threadID))curThread=threadID;
curThread=parseInt(curThread);
if(isNaN(curThread))return;
if(!xmlhttps[curThread])return;
if(!xmlhttps[curThread].client)return;
radios=document.getElementsByName("radioThreads");
for(var i=0;i0)selectHeaders.options[0].selected=true;
showHeader();
txtSendingData.value=xmlhttps[curThread].requestData;
items_string2select(xmlhttps[curThread].requestData);
if(xmlhttps[curThread].dataType=="Name-Value"){
radioInputType1.checked=true;switchInputType(true);
}else{
radioInputType2.checked=true;switchInputType(false);
}
txtURL.value=xmlhttps[curThread].url;
if(xmlhttps[curThread].method=="get"){
radioMethodGet.checked=true;
}else{
radioMethodPost.checked=true;
}
txtResponseHeader.value=xmlhttps[curThread].responseHeaders;
txtResponseBody.value=xmlhttps[curThread].responseText;
}
function refreshStatus(){
try{
curThread=parseInt(curThread);
if(isNaN(curThread))return;
if(!xmlhttps[curThread])return;
if(!xmlhttps[curThread].client)return;
var readyState=["就绪","解析地址","发送请求","下载中","完成"];
var str=readyState[xmlhttps[curThread].client.readyState];
if(divReadyState.innerHTML!=str)divReadyState.innerHTML=str;
try{divStatus.innerHTML=xmlhttps[curThread].client.status;}catch(e){divStatus.innerHTML="-1";}
if(xmlhttps[curThread].resultTreated==false&&xmlhttps[curThread].client.readyState>2){
txtResponseHeader.value=xmlhttps[curThread].responseHeaders=xmlhttps[curThread].client.getAllResponseHeaders();
txtResponseBody.value=xmlhttps[curThread].responseText=reCode(xmlhttps[curThread].client.responseBody);
if(xmlhttps[curThread].client.readyState==4)xmlhttps[curThread].resultTreated=true;
}
}catch(e){}
}
function setHeader(){
var headerName=txtHeaderName.value, headerValue=txtHeaderValue.value, newOption;
addHeader(headerName,headerValue);
}
function setItem(){
var itemName=txtItemName.value, itemValue=txtItemValue.value, newOption;
addItem(itemName,itemValue);
}
function showHeader(){
if(selectHeaders.selectedIndex
function showItem(){
if(selectItems.selectedIndex
function switchInputType(flag){
if(flag){
divSendingData1.style.display="block";
divSendingData2.style.display="none";
items_string2select(txtSendingData.value);
showItem();
}else{
divSendingData1.style.display="none";
divSendingData2.style.display="block";
txtSendingData.value=items_select2string();
}
}
function thread_setAttribute(strAttName, varAttValue){
curThread=parseInt(curThread);
if(isNaN(curThread))return;
if(!xmlhttps[curThread])return;
if(!xmlhttps[curThread].client)return;
switch(strAttName){
case "url":
xmlhttps[curThread].url=varAttValue;
break;
case "method":
xmlhttps[curThread].method=varAttValue;
break;
case "headers":
xmlhttps[curThread].headers=varAttValue;
break;
case "dataType":
xmlhttps[curThread].dataType=varAttValue;
break;
case "requestData":
xmlhttps[curThread].requestData=varAttValue;
break;
}
}
/***************
* Some common functions
* Author: Hutia
**/
function htmlEncode(strS){
return(strS.replace(/&/g,"&").replace(//g,">").replace(/ /g," ").replace(/\n/g,"
"));
}
function htmlDecode(strS){
return(strS.replace(/
/ig,"\r\n").replace(/ /ig," ").replace(/>/ig,">").replace(/</ig,"
function uid(){ return("u"+String((new Date()).getTime()).substring(5)+parseInt(Math.random()*100000));}
function getXMLRequester(){
var xmlhttp_request = false;
try{
if( window.ActiveXObject ){
for( var i = 5; i > -1; i-- ){
try{
if( i == 2 ){
xmlhttp_request = new ActiveXObject( "Microsoft.XMLHTTP" );
}else{
xmlhttp_request = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
}
break;
}catch(e){
xmlhttp_request = false;
}
}
}else if( window.XMLHttpRequest ){
xmlhttp_request = new XMLHttpRequest();
}
}catch(e){
xmlhttp_request = false;
}
return xmlhttp_request;
}
function getElementByClassName(obj,className){
for(var i=0;i
function reCode(b){
var t=rsB(b);
t=escape(t).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2");
t=t.split("@");
var i=0,j=t.length,k;
while(++i
function initVBS(){
strVBS="\r\n";
strVBS+="Function rsB(vIn)\r\nrsB=MidB(vIn,1)\r\nEnd Function\r\n";
strVBS+="Function vbChar(ss)\r\nvbChar = Chr(ss)\r\nEnd Function\r\n";
strVBS+="Function ascCode(chrV)\r\n ascCode = hex(asc(chrV)) \r\n End Function \r\n";
strVBS+="Function toHex(ss)\r\n toHex = eval(\"&H\"+ss) \r\n End Function \r\n";
strVBS+="";
document.write(strVBS);
}
/*
This following code are designed and writen by Windy_sk
You can use it freely, but u must held all the copyright items!
Especially thanks to 色眯眯的小疯狗
Modified By Hutia.
*/
String.prototype.GetCount = function(str,mode){return eval("this.match(/("+str+")/g"+(mode?"i":"")+").length");}
function UrlEncode(str){
/*-- Modify from qiushuiwuhen --*/
var i,temp,p,q;
var result="";
for(i=0;i=0x4e00){
result+=ascCode(str.charAt(i)).replace(/(.{2})/g, "%$1");
}else{
result+=escape(str.charAt(i));
}
}
return result;
}
function UrlDecode(str){
var i,temp;
var result="";
for(i=0;i
function Decode_unit(str){
var p,q = "";
if(str.GetCount("%")!=2)return str;
p=eval("0x" + str.split("%")[1]);
q=eval("0x" + str.split("%")[2]);
if(p
//**确认需要的VBScript函数是否存在,不存在就写一个****
try{
if(typeof(rsB)=="undefined"){initVBS();};
}catch(e){initVBS();}
window.onload=init;
Threads
Settings
URL:
Method:
Get
Post
Headers:
Header Name:
Header Value:
Sending String
Input type:
Name-Value
By-String
Items:
Item Name:
Item Value:
Data String:
Current State
Ready State:
就绪
Status:
-1
Operation
Operations:
Response Data
Headers:
Body:
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]