Let's see a lot of people who need it. Let's share some good things.  
CopyCode The Code is as follows: function content_code (STR) 
Dim ary_string, I, n, n_pos 
Ary_string = Split (STR, "[Code]") 
N = ubound (ary_string) 
If n <1 then 
Content_code = Str 
Exit Function 
End if 
For I = 1 to n 
N_pos = instr (ary_string (I), "[/Code]") 
If n_pos> 0 then 
Ary_string (I) = "<br/> <textarea class = gocode id = runcode" & I & "name = runcode" & I & ">" & server. htmlencode (left (ary_string (I), n_pos-1 )) & "</textarea> <br/> <input type = button class = input-code value = Running code onclick = runcode (runcode" & I & ")> <input type = button class = input-code value = copy code onclick = copycode (runcode "& I &")> <input type = button class = input-code value = save code onclick = savecode (runcode "& I &")> <SPAN class = code-tishi> prompt: you can modify some code before running </span> <br/> "&_ 
Right (ary_string (I), Len (ary_string (I)-n_pos-6) 
Else 
Ary_string (I) = "[Code]" & ary_string (I) 
End if 
Next 
Content_code = join (ary_string ,"") 
End Function 
 
The usage is also simple:
 
 
PostArticleYou must use the "run code" function.
 
 
 
[Code] [/Code]
For example:
 
  
Copy code The Code is as follows: [Code] 
<SCRIPT type = "text/JavaScript"> 
Alert ("simple "); 
</SCRIPT> 
[/Code] 
 
Note that you need to enter the following JavaScript on the displayed page:
 
  
Copy code The Code is as follows: function runcode (OBJ ){ 
VaR winname = Window. Open (''," _ blank ",''); 
Winname.doc ument. Open ('text/html ', 'replace '); 
Winname. Opener = NULL 
Winname.doc ument. writeln (obj. value ); 
Winname.doc ument. Close (); 
} 
 
 
 
 
Function copycode (OBJ ){
VaR RNG = Document. Body. createTextRange ();
RNG. movetoelementtext (OBJ );
RNG. scrollintoview ();
RNG. Select ();
Rng.exe ccommand ("copy ");
RNG. Collapse (false );
}
Function savecode (OBJ ){
VaR winname = Window. Open ('', '_ blank', 'top = 10000 ');
Winname.doc ument. Open ('text/html ', 'replace ');
Winname.doc ument. Write (obj. value );
Winname.document.execcommand('saveas', '', 'code.htm ');
Winname. Close ();
}