国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

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

2019-11-21 02:08:31
字體:
來源:轉載
供稿:網友
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樓
在客戶端實現保存的方法:   
  <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>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 阜南县| 镇赉县| 高雄县| 三都| 宁都县| 南平市| 抚州市| 探索| 临沧市| 和平县| 原平市| 龙井市| 礼泉县| 南靖县| 来安县| 绥滨县| 沅陵县| 屏东市| 赤水市| 临城县| 平武县| 缙云县| 宝兴县| 汽车| 芜湖县| 梧州市| 金秀| 南昌市| 亚东县| 和田县| 和政县| 石柱| 洪江市| 和田县| 额尔古纳市| 鲁甸县| 翁牛特旗| 乐昌市| 墨脱县| 原阳县| 格尔木市|