Home > Web Front-end > JS Tutorial > The value of textarea is the source code of the html file, which is saved as the code of the html file_form effects

The value of textarea is the source code of the html file, which is saved as the code of the html file_form effects

WBOY
Release: 2016-05-16 19:14:47
Original
1245 people have browsed it

textarea的value是html文件源代码,如何把源代码存成html文件??   
  如   
     
  

   
     
  hmtl页面   
     
     
      alert(ok);   
     
     

1楼
dim   fileNameStr   
  fileNameStr   =   Trim(Request.Form("fileName"))   
  dim   fileContentStr   
  fileContentStr   =   Trim(Request.Form("fileContent"))   
  Set   fs   =   CreateObject("Scripting.FileSystemObject")   
  dim   filePath   
  filePath   =   Server.MapPath("PageURL/"   &   fileNameStr)   
  Set   a   =   fs.CreateTextFile(filePath,   True)   
  a.WriteLine(fileContentStr)   
  a.Close 
2楼
在客户端实现保存的方法:   
  
   
     
  <script> <BR> <!-- <BR> function Save() <BR> { <BR> var txt = document.all.mm; <BR> var ww = window.open("", "_blank", "width=100px, height=100px"); <BR> ww.document.write(txt.value); <BR> ww.document.close(); <BR> ww.document.execCommand('SaveAs'); <BR> //ww.document.execCommand('Saveas',false,'c:\\test.htm'); <BR> ww.close(); <BR> } <BR> //--> <BR> </script>
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