一般在调试ASP程序的时候,有时候不方便修改程序用response.write()输出变量,可以把要输出的变量提交给服务器变量Application("A")=要显示的变量 这样再用response.asp 中用response.write("A")就可以看见变量的内容了。
自做的小程序,方便调试。保存为response.asp放到服务器上,可在小窗口中输入asp语句,按TAB运行,运行结果利用ajax技术在大窗口中无刷新自动显示,如果显示结果内容较多还可以在上面的小输入框中输入关键词按TAB键将所有要查找的关键词高亮显示。
输入框是一个可拖动、可跟随滚动的浮动小窗口,大窗口空白地方隐藏,再双击显示。
<%
...
@ LANGUAGE="VBScript.Encode" CodePage="936"
%>
<% ...
Response.Expires = -9999
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
Response.AddHeader "Content-Type","text/html; charset=gb2312"
%>
<% ... if request("fileContent")<>"" or request("fileContent")<>NULL then
Session("#")=Request("fileContent")
Execute(Session("#"))
else %> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" />
< title > 执行自定义ASP语句 </ title >
< style > ...
#get {...}{
font-size: 9pt;
background-color: #e4e4f3;
line-height:1.2em;
height:1000px;
padding: 20px;
border: 1px solid #5353A8;
word-break:break-all;
white-space:normal;
}
input {...}{
margin:0;
line-height: 1.8;
height: 24px;
border: 0;
;
padding: 0;
}
textarea {...}{
background:#000000;
color:#FFFFFF;
overflow: hidden;
margin:0;
border: 0;
padding: 0;
}
#put {...}{
height: 194px;
width: 372px;
cursor:move;
position:absolute;
left: 400px;
top: 300px;
word-break:break-all;
white-space:normal;
border: 1px solid #999999;
background-color: #666666;
}
</ style >
< script type ="text/javascript" > ...
var xmlHttp = false;
function cxhr()
...{
//创建xmlHttp,Ajax的灵魂
/**//* if (window.ActiveXObject)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
*/
if(window.XMLHttpRequest) ...{
xmlHttp = new XMLHttpRequest();
if(xmlHttp.overrideMimeType) ...{
xmlHttp.overrideMimeType('text/xml');
}
} else if(window.ActiveXObject) ...{
var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
for(var i=0; i<versions.length; i++) ...{
try ...{
xmlHttp = new ActiveXObject(versions[i]);
if(xmlHttp) ...{
return xmlHttp;
}
} catch(e) ...{
//alert(e.message);
}
}
}
}
function t()
...{
cxhr();
// t1[i] = unescape(escape(fileContent.value).replace(/%0D/ig,''));
var url="?fileContent="+unescape(escape(document.getElementById("fileContent").value).replace(/%0D/ig,':'));//生成传递给服务器的变量名字和变量值
xmlHttp.open("POST",url,true);//向服务器传递参数
xmlHttp.onreadystatechange=hsc;//用hsc函数监控服务器的返回信息
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send(null);
//alert("aa");
}
function hsc()
...{
document.getElementById("get").innerHTML="生成中......";
if(xmlHttp.readystate==4)
...{
if (xmlHttp.status==200)//如果服务器响应成功,则输出这个信息
...{
document.getElementById("get").innerHTML=xmlHttp.responseText;
}
else
...{
document.getElementById("get").innerHTML=xmlHttp.responseText;
}
}
}
</ script >
</ head >
< body autocomplete ="off" >
< div id ="put" >
< input onKeyDown ="if(event.keyCode==9){fHl(document.body, this.value);return false;}" size ="30" autocomplete ="off" />< br />
< textarea autocomplete ="off" name ="fileContent" id ="fileContent" cols ="56" rows ="15" onkeydown ="if(event.keyCode==9){t();return false;}" > response.Write(Application("A"))
Application("A")="" </ textarea >
</ div >
< div id ="get" ondblclick ="hidePop();" ></ div >
</ body ></ html >
< script type ="text/javascript" > ...
/**//*----------------------------------------*
* 使用 javascript HTML DOM 高亮显示页面特定字词 By shawl.qiu
* 参数说明:
* o: 对象, 要进行高亮显示的对象.
* flag: 字符串, 要进行高亮的词或多个词, 使用 竖杠(|) 分隔多个词 .
* rndColor: 布尔值, 是否随机显示文字背景色与文字颜色, true 表示随机显示.
* url: URI, 是否对高亮的词添加链接.
*----------------------------------------*/
function fHl(o, flag, rndColor, url)...{
var bgCor=fgCor='';
if(rndColor)...{
bgCor=fRndCor(10, 20);
fgCor=fRndCor(230, 255);
} else ...{
bgCor='yellow';
fgCor='black';
}
var re=new RegExp(flag, 'i');
for(var i=0; i<o.childNodes.length; i++)...{
var o_=o.childNodes[i];
var o_p=o_.parentNode;
if(o_.nodeType==1) ...{
fHl(o_, flag, rndColor, url);
} else if (o_.nodeType==3) ...{
if(!(o_p.nodeName=='A'))...{
if(o_.data.search(re)==-1)continue;
var temp=fEleA(o_.data, flag);
o_p.replaceChild(temp, o_);
}
} // shawl.qiu script
}
//------------------------------------------------
function fEleA(text, flag)...{
var style=' style="background-color:'+bgCor+';color:'+fgCor+';font-size:24px" '
var o=document.createElement('span');
var str='';
var re=new RegExp('('+flag+')', 'gi');
if(url)...{
str=text.replace(re, '<a href="'+url+
'"'+style+'>$1</a>');
} else ...{
str=text.replace(re, '<span '+style+'>$1</span>');
}
o.innerHTML=str;
return o;
} // shawl.qiu script
//------------------------------------------------
function fRndCor(under, over)...{
if(arguments.length==1)...{
var over=under;
under=0;
}else if(arguments.length==0)...{
var under=0;
var over=255;
}
var r=fRandomBy(under, over).toString(16);
r=padNum(r, r, 2);
var g=fRandomBy(under, over).toString(16);
g=padNum(g, g, 2);
var b=fRandomBy(under, over).toString(16);
b=padNum(b, b, 2);
//defaultStatus=r+' '+g+' '+b
return '#'+r+g+b;
function fRandomBy(under, over)...{
switch(arguments.length)...{
case 1: return parseInt(Math.random()*under+1);
case 2: return parseInt(Math.random()*(over-under+1) + under);
default: return 0;
}
} // shawl.qiu script
function padNum(str, num, len)...{
var temp=''
for(var i=0; i<len;temp+=num, i++);
return temp=(temp+=str).substr(temp.length-len);
} // shawl.qiu script
}
}
</ script >
< script language ="javascript" type ="text/javascript" > ...
<!--
//拖动浮动动输入框
$ = function(d)...{return document.getElementById(d);}
function gs2(d,a)...{
if (d.currentStyle)...{
var curVal=d.currentStyle[a]
}else...{
var curVal=document.defaultView.getComputedStyle(d, null)[a]
}
return curVal;
}
var dragok = false;
var y,x,d,dy,dx;
var leftadd = 400;topadd = 300;
function move(e)
...{
if (!e) e = window.event;
if (dragok)...{
d.style.left = dx + e.clientX - x + "px";
d.style.top = dy + e.clientY - y + "px";
leftadd=dx+e.clientX - x;
topadd= e.clientY;
return true;
}
}
function down(e)...{
if (!e) e = window.event;
var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
if (window.opera)...{ document.getElementById("Q").focus(); }
dragok = true;
d = temp;
dx = parseInt(gs2(temp,"left"))|0;
dy = parseInt(gs2(temp,"top"))|0;
x = e.clientX;
y = e.clientY;
document.onmousemove = move;
}
function up()...{
dragok = false;
document.onmousemove = null;
}
window.onload = function()...{
$("put").onmousedown = down;
$("put").onmouseup = up;
window.onscroll = function ()...{
$("put").style.left = (document.documentElement.scrollLeft + leftadd) +"px";
$("put").style.top = (document.documentElement.scrollTop + topadd) +"px";
};
}
function hidePop()...{
if(document.getElementById("put").style.display == "none")
document.getElementById("put").style.display = "block";
else
document.getElementById("put").style.display = "none";
}
-->
</ script >
<% ... end if %>
<% ...
Response.Expires = -9999
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
Response.AddHeader "Content-Type","text/html; charset=gb2312"
%>
<% ... if request("fileContent")<>"" or request("fileContent")<>NULL then
Session("#")=Request("fileContent")
Execute(Session("#"))
else %> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" />
< title > 执行自定义ASP语句 </ title >
< style > ...
#get {...}{
font-size: 9pt;
background-color: #e4e4f3;
line-height:1.2em;
height:1000px;
padding: 20px;
border: 1px solid #5353A8;
word-break:break-all;
white-space:normal;
}
input {...}{
margin:0;
line-height: 1.8;
height: 24px;
border: 0;
;
padding: 0;
}
textarea {...}{
background:#000000;
color:#FFFFFF;
overflow: hidden;
margin:0;
border: 0;
padding: 0;
}
#put {...}{
height: 194px;
width: 372px;
cursor:move;
position:absolute;
left: 400px;
top: 300px;
word-break:break-all;
white-space:normal;
border: 1px solid #999999;
background-color: #666666;
}
</ style >
< script type ="text/javascript" > ...
var xmlHttp = false;
function cxhr()
...{
//创建xmlHttp,Ajax的灵魂
/**//* if (window.ActiveXObject)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp=new XMLHttpRequest();
}
*/
if(window.XMLHttpRequest) ...{
xmlHttp = new XMLHttpRequest();
if(xmlHttp.overrideMimeType) ...{
xmlHttp.overrideMimeType('text/xml');
}
} else if(window.ActiveXObject) ...{
var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
for(var i=0; i<versions.length; i++) ...{
try ...{
xmlHttp = new ActiveXObject(versions[i]);
if(xmlHttp) ...{
return xmlHttp;
}
} catch(e) ...{
//alert(e.message);
}
}
}
}
function t()
...{
cxhr();
// t1[i] = unescape(escape(fileContent.value).replace(/%0D/ig,''));
var url="?fileContent="+unescape(escape(document.getElementById("fileContent").value).replace(/%0D/ig,':'));//生成传递给服务器的变量名字和变量值
xmlHttp.open("POST",url,true);//向服务器传递参数
xmlHttp.onreadystatechange=hsc;//用hsc函数监控服务器的返回信息
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlHttp.send(null);
//alert("aa");
}
function hsc()
...{
document.getElementById("get").innerHTML="生成中......";
if(xmlHttp.readystate==4)
...{
if (xmlHttp.status==200)//如果服务器响应成功,则输出这个信息
...{
document.getElementById("get").innerHTML=xmlHttp.responseText;
}
else
...{
document.getElementById("get").innerHTML=xmlHttp.responseText;
}
}
}
</ script >
</ head >
< body autocomplete ="off" >
< div id ="put" >
< input onKeyDown ="if(event.keyCode==9){fHl(document.body, this.value);return false;}" size ="30" autocomplete ="off" />< br />
< textarea autocomplete ="off" name ="fileContent" id ="fileContent" cols ="56" rows ="15" onkeydown ="if(event.keyCode==9){t();return false;}" > response.Write(Application("A"))
Application("A")="" </ textarea >
</ div >
< div id ="get" ondblclick ="hidePop();" ></ div >
</ body ></ html >
< script type ="text/javascript" > ...
/**//*----------------------------------------*
* 使用 javascript HTML DOM 高亮显示页面特定字词 By shawl.qiu
* 参数说明:
* o: 对象, 要进行高亮显示的对象.
* flag: 字符串, 要进行高亮的词或多个词, 使用 竖杠(|) 分隔多个词 .
* rndColor: 布尔值, 是否随机显示文字背景色与文字颜色, true 表示随机显示.
* url: URI, 是否对高亮的词添加链接.
*----------------------------------------*/
function fHl(o, flag, rndColor, url)...{
var bgCor=fgCor='';
if(rndColor)...{
bgCor=fRndCor(10, 20);
fgCor=fRndCor(230, 255);
} else ...{
bgCor='yellow';
fgCor='black';
}
var re=new RegExp(flag, 'i');
for(var i=0; i<o.childNodes.length; i++)...{
var o_=o.childNodes[i];
var o_p=o_.parentNode;
if(o_.nodeType==1) ...{
fHl(o_, flag, rndColor, url);
} else if (o_.nodeType==3) ...{
if(!(o_p.nodeName=='A'))...{
if(o_.data.search(re)==-1)continue;
var temp=fEleA(o_.data, flag);
o_p.replaceChild(temp, o_);
}
} // shawl.qiu script
}
//------------------------------------------------
function fEleA(text, flag)...{
var style=' style="background-color:'+bgCor+';color:'+fgCor+';font-size:24px" '
var o=document.createElement('span');
var str='';
var re=new RegExp('('+flag+')', 'gi');
if(url)...{
str=text.replace(re, '<a href="'+url+
'"'+style+'>$1</a>');
} else ...{
str=text.replace(re, '<span '+style+'>$1</span>');
}
o.innerHTML=str;
return o;
} // shawl.qiu script
//------------------------------------------------
function fRndCor(under, over)...{
if(arguments.length==1)...{
var over=under;
under=0;
}else if(arguments.length==0)...{
var under=0;
var over=255;
}
var r=fRandomBy(under, over).toString(16);
r=padNum(r, r, 2);
var g=fRandomBy(under, over).toString(16);
g=padNum(g, g, 2);
var b=fRandomBy(under, over).toString(16);
b=padNum(b, b, 2);
//defaultStatus=r+' '+g+' '+b
return '#'+r+g+b;
function fRandomBy(under, over)...{
switch(arguments.length)...{
case 1: return parseInt(Math.random()*under+1);
case 2: return parseInt(Math.random()*(over-under+1) + under);
default: return 0;
}
} // shawl.qiu script
function padNum(str, num, len)...{
var temp=''
for(var i=0; i<len;temp+=num, i++);
return temp=(temp+=str).substr(temp.length-len);
} // shawl.qiu script
}
}
</ script >
< script language ="javascript" type ="text/javascript" > ...
<!--
//拖动浮动动输入框
$ = function(d)...{return document.getElementById(d);}
function gs2(d,a)...{
if (d.currentStyle)...{
var curVal=d.currentStyle[a]
}else...{
var curVal=document.defaultView.getComputedStyle(d, null)[a]
}
return curVal;
}
var dragok = false;
var y,x,d,dy,dx;
var leftadd = 400;topadd = 300;
function move(e)
...{
if (!e) e = window.event;
if (dragok)...{
d.style.left = dx + e.clientX - x + "px";
d.style.top = dy + e.clientY - y + "px";
leftadd=dx+e.clientX - x;
topadd= e.clientY;
return true;
}
}
function down(e)...{
if (!e) e = window.event;
var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
if (window.opera)...{ document.getElementById("Q").focus(); }
dragok = true;
d = temp;
dx = parseInt(gs2(temp,"left"))|0;
dy = parseInt(gs2(temp,"top"))|0;
x = e.clientX;
y = e.clientY;
document.onmousemove = move;
}
function up()...{
dragok = false;
document.onmousemove = null;
}
window.onload = function()...{
$("put").onmousedown = down;
$("put").onmouseup = up;
window.onscroll = function ()...{
$("put").style.left = (document.documentElement.scrollLeft + leftadd) +"px";
$("put").style.top = (document.documentElement.scrollTop + topadd) +"px";
};
}
function hidePop()...{
if(document.getElementById("put").style.display == "none")
document.getElementById("put").style.display = "block";
else
document.getElementById("put").style.display = "none";
}
-->
</ script >
<% ... end if %>