- <HTML>
- <HEAD>
- <META content="text/html;charset=gb2312" http-equiv="Content-Type">
- </head>
- <body>
- <script type="text/javascript">
- function saveas()
- {
- var winSave = window.open();
- winSave.document.open ("text/html","utf-8");
- winSave.document.write (document.getElementById("dataarea").value);
- winSave.document.execCommand ('SaveAs',true,'test.txt','.txt');
- winSave.close();
- }
- </script>
- <textarea id="dataarea">
- Test, just a test
- </textarea>
- <input type=button value="另存为" onclick="saveas()">
- </body>
- </html>
IE中保存textarea中数据为本地文件
最新推荐文章于 2020-03-03 16:26:35 发布
本文介绍了一个简单的HTML页面,该页面通过JavaScript实现了将文本区域的内容保存为文本文件的功能。此方法适用于需要快速导出数据的应用场景。
361

被折叠的 条评论
为什么被折叠?



