Copy the following code. It is best to use editplus and other professional editing tools.
Copy codeThe Code is as follows: <! 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> page content catcher </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 );
// Open a browser
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.doc ument;} catch (e) {window. close () ;}, 1); // exit the program automatically after the window is closed.
// Close the browser when the page is uninstalled
Window. onunload = function () {win. quit ();}
// Automatic capture
SetInterval (doCapture, 1 );
}
Function doCapture (){
Try {
Win.doc ument. onclick = capIt;
} Catch (e ){}
}
Function capIt (){
Var d = win.doc ument, 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.doc ument. 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.doc ument. 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 ");
N1_doc ument. open ();
N1_doc ument. write ($ ("output"). value );
N1_doc ument. close ();
}
</Script>
</Head>
<Body>
<Ul>
<Li>
Currently, the object has been captured:
<A href = "###" onclick = "showCapture (this. bound); return false;" id = "currentObj"> none </a> <
<A href = "###" onclick = "parentCapture (); return false;"> Get parent object </a>
|
<A href = "###" onclick = "doExportHTML (); return false;"> export HTML </a>
|
<A href = "###" onclick = "showCaptureCurrentStyle (); return false;"> export the current style </a>
|
<A href = "###" onclick = "showCaptureAllEvent (); return false;"> export all events bound to it </a>
</Li>
<Li>
Export the internal style sheet:
<A href = "###" onclick = "doExportInnerCSS (); return false;"> export </a>
</Li>
<Li>
Export JS functions:
<Input type = "text" value = "" onfocus = "this. value =''; "size =" 30 "id =" funcName ">
|
<A href = "###" onclick = "doExportFunction (); return false;"> export </a>
</Li>
<Li>
Exported data:
|
<A href = "###" onclick = "doTest (); return false;"> test </a>
|
<A href = "###" onclick = "$ ('output'). value =''; return false; "> clear </a>
<Br/>
<Textarea id = "output"> </textarea>
</Li>
</Ul>
</Body>
</Html>
The usage is as follows:
1. Files in the compressed package
2. After running, a program window and an IE browser window will appear, arranged up and down
3. Enter the website address for code deduction in the browser, and press enter to enter the desired site.
4. Click the mouse over the effect of the Code to be deducted, for example, the link in. You can see that this object has been captured in the program window. If you need a parent object, you only need to click the "get parent object" link in the program window.
5. Click the "Export HTML" link in the program window to obtain the HTML content of the current object (even if the content is dynamically generated by a script)
6. Enter the JS function name you want to view in the text box after "Export JS function" (in the form of "gbar. qs" supported) to obtain the JS function content. This removes the hassle of searching an external JS file.
Consider other features.
Leave a message if you have any questions.
File packaging download http://xiazai.jb51.net/200909/yuanma/buhuozhe.rar