国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

扣代碼工具 hta版

2020-01-25 19:40:08
字體:
供稿:網(wǎng)友
需要用到 InternetExplorer.Application 對象,所以做成了HTA文件。代碼如下:(不能直接運行,請下載附件運行其中的 “捕獲者.hta”,或者將下面代碼復制后保存到本地并以 hta 為擴展名)
 
復制下面的代碼,最好用editplus等專業(yè)點的編輯工具。
復制代碼代碼如下:

<!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>頁面內(nèi)容捕獲器</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 += "/r/n<!--Current Style:/r/n" + re.join(" ") + "/r/n-->/r/n"; 

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 += "/r/n<!--All Bound Event:/r/n" + re.join("/r/n") + "/r/n-->/r/n"; 

function doExportHTML(){ 
    if(!$("currentObj").bound)return; 
    $("output").value += "/r/n" + $("currentObj").bound.outerHTML + "/r/n"; 

function doExportInnerCSS(){ 
    var o = win.document.getElementsByTagName("style"); 
    for(var i=0; i<o.length; i++)$("output").value += "/r/n<style>/r/n" + o[i].innerHTML + "/r/n<//style>/r/n"; 

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 += "/r/n<script>/r/n" + o + "/r/n<//script>/r/n"; 

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> 
        導出內(nèi)部樣式表: 
        <a href="###" onclick="doExportInnerCSS(); return false;">導出</a> 
    </li> 
    <li> 
        導出JS函數(shù): 
        <input type="text" value="" onfocus="this.value='';" size="30" id="funcName"> 
          |   
        <a href="###" onclick="doExportFunction(); return false;">導出</a> 
    </li> 
    <li> 
        導出的數(shù)據(jù): 
          |   
        <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. 運行后會出現(xiàn)一個程序窗口和一個IE瀏覽器窗口,上下排列 
3.在瀏覽器中輸入需要扣代碼的網(wǎng)站地址,回車進去需要的站點 
4.在需要扣代碼的效果上點擊鼠標,例如上圖中的鏈接。可以看到程序窗口中已經(jīng)捕獲到了這個對象。如果需要其父對象,只需要單擊程序窗口中的 “獲取其父對象” 鏈接。 
5. 單擊程序窗口中的 “導出HTML” 鏈接,可以得到當前對象的HTML內(nèi)容(即使這個內(nèi)容是用腳本動態(tài)生成的也可以捕獲) 
6.在 “導出JS函數(shù)” 后的文本框中輸入想查看的 JS函數(shù)名(支持 “gbar.qs” 這種形式),可以得到 JS 函數(shù)內(nèi)容。免去一個一個外部 JS 文件查找的辛苦。 
其他功能請自己琢磨。 
有什么疑問請留言。 

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 瓮安县| 滦平县| 莲花县| 台北县| 长葛市| 澄江县| 广安市| 牙克石市| 平谷区| 那坡县| 房产| 会理县| 渝中区| 公主岭市| 晋城| 郓城县| 红河县| 清丰县| 米林县| 塔河县| 古丈县| 武冈市| 大邑县| 安达市| 黑龙江省| 高邮市| 法库县| 隆化县| 曲阜市| 朝阳县| 拉孜县| 宿迁市| 开封市| 汤阴县| 玉门市| 碌曲县| 子长县| 沾益县| 沙坪坝区| 福海县| 茶陵县|