function runEx(){
var winEx2 = window.open("", "winEx2",
"width=500,height=300,status=yes,menubar=no,scrollbars=yes,resizable=yes");
winEx2.document.open("text/html", "replace");
winEx2.document.write(unescape(event.srcElement.parentElement.children[0].value));
winEx2.document.close();
}
function saveFile()
{
var win=window.open('','','top=10000,left=10000');
win.document.write(document.all.asdf.innerText)
win.document.execCommand('SaveAs','','a.html')
win.close();
}
wrap=VIRTUAL>
码>
οnclick="asdf.value=''" type=button value=清空>
value=保存代碼>
上面是示例