Home > Web Front-end > JS Tutorial > body text

Save Js web page as implementation code_other special effects

WBOY
Release: 2016-05-16 18:19:06
Original
1102 people have browsed it

Demo code:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute it ]

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.
Copy code The code is as follows:

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!");
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template