To discuz! NT Forum plus script code to run the box method, you can directly in the forum using [html][/html] Insert Script effects method.
In doing Arisisi forum http://bbs.alixixi.com, you need to add the script to the post code. The relevant information is still difficult to find.
DZ Official forum does not provide the relevant script to run the box plug-in, the online public also only PHP version of the solution, and there are many problems.
Studied for half a day, finally found a solution, the final implementation of the results are as follows, you can support multiple script run box:
Full debugging and full support for all script debugging functions.
The method is as follows:
1, into the dz! NT Background >> posts >> posts related discuz! NT code, set the following figure and Save:
The replacement content is:
<textarea id= "{RANDOM}" rows= "cols=" >{1}</textarea><br><input Onclick=runex ("{RANDOM}" ) type= "button" value= "Run"/> <input onclick=docopy ("{RANDOM}") type= "button" value= "Copy"/> <input class= "su Bmit1 "Onclick=dosave (" {RANDOM} ") type=" button "value=" Save "/> Hint: You can modify the code before you run
2, modify the javascript/common.js of the Forum root directory, add the following script code at the end:
//Run code
Function RunEx (cod1) {
Cod=document.getelementbyid (cod1)
var Code=cod.value;
if (code!= "") {
var newwin=window.open (', ', ', ');
Newwin.opener = null
newwin.document.write (code);
Newwin.document.close ();
}
}
//Copy code
Function DoCopy2 (ID) {
if (document.all) {
textRange = document.getelemen Tbyid (ID). createTextRange ();
Textrange.execcommand ("Copy");
Alert (' Copy succeeded ');
}
else{
alert (this feature can only be valid on IE)
}
//Copy code
Function docopy (obj) {
var rng = Document.body.createTextRange ();
rng.movetoelementtext (obj);
rng.scrollintoview ();
rng.select ();
rng.execcommand ("Copy");
rng.collapse (FALSE);
}
function Docopyurl ()
{
document.getElementById ("Copyurl"). Value=parent.location.href;
document.getElementById ("Copyurl"). Select ();
Document.execcommand ("copy");
Alert ("URL successfully copied to clipboard!") ")
}
Save Code
function Dosave (obj) {
var winname = window.open (', ' _blank ', ' top=10000 ');
Winname.document.open (' text/html ', ' replace ');
Winname.document.writeln (Obj.value);
Winname.document.execCommand (' SaveAs ', ', ', ' code.htm ');
Winname.close ();
}
You can use the two steps above to implement the Code run box effect, and finally add the test:
Through the above steps can be easily achieved.
This article for the Arisisi Web Development Home Original, reprint please indicate from Www.alixixi.com.