扣代码工具 hta版

复制下面的代码,最好用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<!--Current Style:rn" + re.join(" ") + "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<!--All Bound Event:rn" + re.join("rn") + "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="###" onclick="showCapture(this.bound); return false;" id="currentObj">无</a>    <<   
        <a href="###" onclick="parentCapture(); return false;">获取其父对象</a>
          |  
        <a href="###" onclick="doExportHTML(); return false;">导出HTML</a>
          |  
        <a href="###" onclick="showCaptureCurrentStyle(); return false;">导出其当前样式</a>
          |  
        <a href="###" onclick="showCaptureAllEvent(); return false;">导出其绑定的所有事件</a>

    </li>
    <li>
        导出内部样式表:
        <a href="###" onclick="doExportInnerCSS(); return false;">导出</a>
    </li>
    <li>
        导出JS函数:
        <input type="text" value="" onfocus="this.value='';" size="30" id="funcName">
          |  
        <a href="###" onclick="doExportFunction(); return false;">导出</a>
    </li>
    <li>
        导出的数据:
          |  
        <a href="###" onclick="doTest(); return false;">测试</a>
          |  
        <a href="###" onclick="$('output').value=''; return false;">清除</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.laike.net/200909/yuanma/buhuozhe.rar