Save page as JS code

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags ajax button code content document html javascript save

Web page Save as two JS code

In fact, a lot of time we need to save the content of the Web page directly as, below we provide two JS save as a Web page code.

<html>
<head>
<title> Save pages </title>
</head>
<body>
<object classid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
height= "0" width= "0" id=webbrowser></object>
<input type= "button" value= "Save Web Page" onclick= "WEBBROWSER.EXECWB (4,1)" >
</body>
</html>


Method Two

<input Type=button value= Save As Onclick=document.execcommand (' SaveAs ', false, ' c:test.htm ') >


Method Three

&lt;input Name=button ONCLICK=DOCUMENT.ALL.WEBBROWSER.EXECWB (4,1) Type=button value= Save as &gt;&lt;object classid= CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=webbrowser width=0&gt;&lt;/object&gt;


See a Save as an instance

Save as a specified file or page

function savehtm (p_filename)


{  


var winname = window.open ('.    /upload/' +p_filename, ' _blank ', ' top=10000 ';


Winname.document.execcommand (' SaveAs ', ', ', p_filename);


Winname.close ();


}


//Save as current page


&lt;input Type=button value= Save as HTM onclick= "Document.execcommand (' SaveAs ', ' true ', ' xrx.htm ')" &gt;


&lt;p align= "center" &gt;


&lt;input Type=button value= Save as txt onclick= "Document.execcommand (' SaveAs ', ' true ', ' xrx.txt ')" &gt;&lt;/p&gt;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.