手机
当前位置:查字典教程网 >脚本专栏 >hta >扣代码工具 hta版
扣代码工具 hta版
摘要:复制下面的代码,最好用editplus等专业点的编辑工具。复制代码代码如下:页面内容捕获器*{font-size:12px;}html{pa...

复制下面的代码,最好用editplus等专业点的编辑工具。

复制代码 代码如下:

<!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=utf-8" />

<title>页面内容捕获器</title>

<style>

* { font-size:12px; }

html { padding:0px; margin:0px; border-style:none; border-width:0px; overflow:auto; background-color:buttonface; }

body { padding:0px; margin:0px; border-style:none; border-width:0px; background-color:buttonface; }

li { line-height:24px; height:24px; margin:10px 0px -10px 15px; }

a { color:blue; }

input { border-width:1px; }

#output { width:90%; height:150px; overflow:auto; }

</style>

<script>

var win;

function $(s){ return document.getElementById(s); }

window.onload = function(){

var myHeight = 320;

window.moveTo(0,0);

window.resizeTo(screen.availWidth, myHeight);

//打开一个浏览器

win = new ActiveXObject("InternetExplorer.Application");

win.left = 0; win.top = myHeight;

win.width = screen.availWidth; win.height = screen.availHeight - myHeight;

win.navigate2("about:blank");

win.visible = true;

setInterval(function(){ try{ win.document; }catch(e){ window.close(); } }, 1); //窗口关闭后自动退出程序

//页面卸载时关闭浏览器

window.onunload = function(){ win.quit(); }

//自动捕获

setInterval(doCapture, 1);

}

function doCapture(){

try{

win.document.onclick = capIt;

}catch(e){}

}

function capIt(){

var d = win.document, w = d.parentWindow, e = w.event, el = e.srcElement;

$("currentObj").bound = el;

$("currentObj").innerHTML = el.tagName;

showCapture(el);

e.cancelBubble = true;

e.returnValue = false;

return false;

}

function showCapture(el){

if(!el)return;

var oldBorderStyle = el.style.borderStyle, oldBorderWidth = el.style.borderWidth, oldBorderColor = el.style.borderColor;

el.style.border = "2px solid red";

setTimeout(function(){ try{ el.style.borderStyle = oldBorderStyle; el.style.borderWidth = oldBorderWidth; el.style.borderColor = oldBorderColor; }catch(e){} }, 300);

}

function parentCapture(){

var el = $("currentObj").bound;

if(!el || !el.parentNode || el.parentNode.nodeType != 1 )return;

el = el.parentNode;

$("currentObj").bound = el;

$("currentObj").innerHTML = el.tagName;

showCapture(el);

}

function showCaptureCurrentStyle(){

var el = $("currentObj").bound;

if(!el)return;

var re = [], s = el.currentStyle;

for(var i in s)if(s[i] != "")re.push(i+":"+s[i]+";");

$("output").value += "rn<>rn";

}

function showCaptureAllEvent(){

var el = $("currentObj").bound, re = [];

if(!el)return;

for(var i in el)if(String(i).indexOf("on") == 0 && el[i])re.push(String(el[i]));

$("output").value += "rn<>rn";

}

function doExportHTML(){

if(!$("currentObj").bound)return;

$("output").value += "rn" + $("currentObj").bound.outerHTML + "rn";

}

function doExportInnerCSS(){

var o = win.document.getElementsByTagName("style");

for(var i=0; i<o.length; i++)$("output").value += "rn<style>rn" + o[i].innerHTML + "rn</style>rn";

}

function doExportFunction(){

var o = win.document.parentWindow, str = $("funcName").value.split("."), i = -1;

while(++i< str.length && (o = o[str[i]]));

if(!o)return;

$("output").value += "rn<script>rn" + o + "rn</script>rn";

}

function doTest(){

var nw = window.open("", "_blank");

nw.document.open();

nw.document.write($("output").value);

nw.document.close();

}

</script>

</head>

<body>

<ul>

<li>

目前已捕获到对象:

<a href="###" id="currentObj">无</a> <<

<a href="###">获取其父对象</a>

|

<a href="###">导出HTML</a>

|

<a href="###">导出其当前样式</a>

|

<a href="###">导出其绑定的所有事件</a>

</li>

<li>

导出内部样式表:

<a href="###">导出</a>

</li>

<li>

导出JS函数:

<input type="text" value="" onfocus="this.value='';" size="30" id="funcName">

|

<a href="###">导出</a>

</li>

<li>

导出的数据:

|

<a href="###">测试</a>

|

<a href="###">清除</a>

<br/>

<textarea id="output"></textarea>

</li>

</ul>

</body>

</html>

使用方法是这样的:

1. 压缩包中的文件

2. 运行后会出现一个程序窗口和一个IE浏览器窗口,上下排列

3.在浏览器中输入需要扣代码的网站地址,回车进去需要的站点

4.在需要扣代码的效果上点击鼠标,例如上图中的链接。可以看到程序窗口中已经捕获到了这个对象。如果需要其父对象,只需要单击程序窗口中的 “获取其父对象” 链接。

5. 单击程序窗口中的 “导出HTML” 链接,可以得到当前对象的HTML内容(即使这个内容是用脚本动态生成的也可以捕获)

6.在 “导出JS函数” 后的文本框中输入想查看的 JS函数名(支持 “gbar.qs” 这种形式),可以得到 JS 函数内容。免去一个一个外部 JS 文件查找的辛苦。

其他功能请自己琢磨。

有什么疑问请留言。

文件打包下载 http://xiazai.jb51.net/200909/yuanma/buhuozhe.rar

【扣代码工具 hta版】相关文章:

hta编写的消费记录程序

vpn连接程序hta版实现代码(修改)

XMLHttps

用hta实现制作的无殇 - 快书V1.1打包下载了第1/2页

用hta做的好玩的小程序(固定在桌面)

用hta[javascript]写的定时重启或关机的小工具

A notepad made in HTA(hta实现的记事本)

离22周岁距离多长时间的计算[适合没到22周岁的朋友]

hta 实现的五子棋界面

winXP下用VBS写的代码编辑器

精品推荐
分类导航