网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 扣代码工具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 += \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>
            导出内部样式表:
            <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 文件查找的辛苦。
    其他功能请自己琢磨。
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/20 22:20:42