Demo code:
The above code can only be used in It is used under the IE kernel browser, but for the specific above code saving function, you can refer to the following code.
function runCode(obj) {
var winname = window.open('', "_blank", '');
winname.document.open('text/html', 'replace');
winname.opener = null // Prevent code from entering the parent page Modify
winname.document.write(obj.value);
winname.document.close();
}
function saveCode(obj) {
var winname = window.open(' ', '_blank', 'top=10000');
winname.document.open('text/html', 'replace');
winname.document.write(obj.value);
winname.document.execCommand('saveas','','code.htm');
winname.close();
}
function oCopy(obj){
obj. select();
js=obj.createTextRange();
js.execCommand("Copy");
alert("Script Home Tip: The code has been successfully copied!");
}