<script>
//对代码进行操作
function runCode(obj)
{
var winname =
window.open("",
"_blank","resizable=yes,scrollbars=yes,status=yes");
winname.document.open("text/html",
"replace");
winname.document.writeln(obj.value);
winname.document.close();
}
function
saveCode(obj,filename)
{
var winname = window.open("", "",
"top=10000,left=10000");
winname.document.open("text/html",
"replace");
winname.document.writeln(obj.value);
winname.document.execCommand("saveas",
"", filename + ".htm");
winname.close();
}
function
copyCode(obj)
{
var rng =
document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
</script>
<textarea name=yongfa365
id=yongfa365></textarea>
<input type=button
onclick=runCode(document.getElementById("yongfa365"))
value="运行代码">
<input type=button
onclick=copyCode(document.getElementById("yongfa365"))
value="复制代码">
<input type=button
onclick=saveCode(document.getElementById("yongfa365"),"运行,复制,保存,run,copy,save,代码")
value="保存代码">