<textarea rows="20" cols="80" id="codeMain"></textarea><br>
<input type="button" value="运行代码" onclick="runCode(codeMain)">
<input type="button" value="复制代码" onclick="copyCode(codeMain)">
<input type="button" value="另存代码" onclick="saveCode(codeMain)"> 提示:你可以先修改部分代码再运行<br>
<script>
/******************************************************************************
Crossday Discuz! Board - Common Modules for Discuz!
Modified by: Crossday Studio (http://crossday.com)
Based upon: http://www.cnzzz.com
*******************************************************************************/
function copyCode(obj) {
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
function runCode(obj) {
var winname = window.open('', "_blank", '');
winname.document.open('text/html', 'replace');
winname.document.writeln(obj.value);
winname.document.close();
}
function saveCode(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();
}
var buff = new Array();
function mirror(str)
{
buff.push(str);
codeMain.value += str + "\n";
}
function reflect()
{
for (var i = 0; i < buff.length; i++)
{
codeMain.value += ("\tmirror(\"");
codeMain.value += (buff[i].replace(/\\/g,"\\\\").replace(/\ /g,"\t").replace(/"/g,"\"")+"");n");
}
codeMain.value += ("}\n<\/script>");
}
printself();
reflect();
function printself()
{
mirror("<textarea rows=\"20\" cols=\"80\" id=\"codeMain\"></textarea><br>");
mirror("<input type=\"button\" value=\"运行代码\" onclick=\"runCode(codeMain)\">");
mirror("<input type=\"button\" value=\"复制代码\" onclick=\"copyCode(codeMain)\">");
mirror("<input type=\"button\" value=\"另存代码\" onclick=\"saveCode(codeMain)\"> 提示:你可以先修改部分代码再运行<br>");
mirror("<script>");
mirror("/******************************************************************************");
mirror(" Crossday Discuz! Board - Common Modules for Discuz!");
mirror(" Modified by: Crossday Studio (http://crossday.com)");
mirror(" Based upon: http://www.cnzzz.com");
mirror("*******************************************************************************/");
mirror("function copyCode(obj) {");
mirror("\tvar rng = document.body.createTextRange();");
mirror("\trng.moveToElementText(obj);");
mirror("\trng.scrollIntoView();");
mirror("\trng.select();");
mirror("\trng.execCommand(\"Copy\");");
mirror("\trng.collapse(false);");
mirror("}");
mirror("");
mirror("function runCode(obj) {");
mirror("\tvar winname = window.open('', \"_blank\", '');");
mirror("\twinname.document.open('text/html', 'replace');");
mirror("\twinname.document.writeln(obj.value);");
mirror("\twinname.document.close();");
mirror("}");
mirror("");
mirror("function saveCode(obj) {");
mirror("\tvar winname = window.open('', '_blank', 'top=10000');");
mirror("\twinname.document.open('text/html', 'replace');");
mirror("\twinname.document.writeln(obj.value);");
mirror("\twinname.document.execCommand('saveas','','code.htm');");
mirror("\twinname.close();");
mirror("}");
mirror("");
mirror("var buff = new Array();");
mirror("");
mirror("function mirror(str)");
mirror("{");
mirror("\tbuff.push(str);");
mirror("\tcodeMain.value += str + \"\n";");
mirror("}");
mirror("");
mirror("function reflect()");
mirror("{");
mirror("\tfor (var i = 0; i < buff.length; i++)");
mirror("\t{");
mirror("\t\tcodeMain.value += (\"\tmirror(\"");");
mirror("\t\tcodeMain.value += (buff[i].replace(/\\\\/g,\"\\\\\\\\\").replace(/\\\t/g,\"\\\\t\").replace(/\\\"/g,\"\\\\\\\"\")+\"\\\");\\n\");");
mirror("\t}");
mirror("\tcodeMain.value += (\"}\\n<\\/script>\");");
mirror("}");
mirror("");
mirror("printself();");
mirror("reflect();");
mirror("");
mirror("function printself()");
mirror("{");
}
</script>