色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

textarea的value是html文件源代碼,存成html文件的代碼

textarea的value是html文件源代碼,如何把源代碼存成html文件??   
  如   
  <html>   
  <head>   
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
  <title>hmtl頁面</title>   
  </head>   
  <body>   
      alert(ok);   
  </body>   
  </html>   

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樓
在客戶端實現(xiàn)保存的方法:   
  <textarea   id=mm   style="width:   500"   rows=8>   
  <html>   
  <head>   
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
  <title>hmtl頁面</title>   
  </head>   
  <body>   
      alert(ok);   
  </body>   
  </html>   
  </textarea><br>   
  <input   type=button   value=save   onclick="Save()">   
  <SCRIPT   LANGUAGE="JavaScript">   
  <!--   
  function   Save()   
  {   
      var   txt   =   document.all.mm;   
      var   ww     =   window.open("",   "_blank",   "width=100px,   height=100px");   
      ww.document.write(txt.value);   
      ww.document.close();   
      ww.document.execCommand('SaveAs');   
      //ww.document.execCommand('Saveas',false,'c://test.htm');   
      ww.close();   
  }   
  //-->   
  </SCRIPT>

JavaScript技術textarea的value是html文件源代碼,存成html文件的代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 汉中市| 乳山市| 彭山县| 苏尼特右旗| 和顺县| 铜山县| 安溪县| 绩溪县| 商河县| 鸡泽县| 靖州| 抚顺市| 华宁县| 凌源市| 渭源县| 宝丰县| 额尔古纳市| 乌鲁木齐县| 石屏县| 乌恰县| 苏州市| 微山县| 岳池县| 宁南县| 仪陇县| 洛扎县| 广东省| 政和县| 金坛市| 丹阳市| 合作市| 贡嘎县| 澄江县| 宁海县| 玛多县| 阿鲁科尔沁旗| 包头市| 万安县| 安西县| 靖宇县| 广德县|