js導出txt示例代碼
更新時間:2014年01月14日 14:50:30 作者:
很多新手朋友們都不知道js怎么導出txt,下面有個不錯的示例,大家可以參考下
復制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Downloadify</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<style type="text/css" media="screen">
body {background: #fff; width: 500px; margin: 20px auto;}
input, textarea, p { font-family: 宋體, 黑體; font-size: 12pt;}
input, textarea { border: solid 1px #aaa; padding: 4px; width: 98%;}
</style>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/downloadify.js"></script>
<!-- <script type="text/javascript" src="js/downloadify.min.js"></script> -->
<script type="text/javascript">
window.load=function(){
Downloadify.create('downloadify',{
filename: function(){
return document.getElementById('filename').value;
},
data: function(){
return document.getElementById('data').value;
},
onComplete: function(){ alert('成功保存文件!'); },
onCancel: function(){ alert('您已經(jīng)取消保存文件'); },
onError: function(){ alert('出現(xiàn)錯誤了'); },
swf: 'js/downloadify.swf',
downloadImage: 'js/download.png',
width: 100,
height: 30,
transparent: true,
append: false
});
}
</script>
</head>
<body onload="load();">
<input type="text" name="filename" value="文件名.txt" id="filename" /><br />
<textarea cols="60" rows="10" name="data" id="data">文件內(nèi)容</textarea>
<p id="downloadify">You must have Flash 10 installed to download this file.</p>
</body>
</html>
相關文章
Bootstrap警告(Alerts)的實現(xiàn)方法
這篇文章主要為大家詳細介紹了Bootstrap警告(Alerts)的實現(xiàn)方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-03-03Uni-App用uView組件庫中u-picker實現(xiàn)地區(qū)的省-市-區(qū)三級聯(lián)動、確認及回顯
最近項目要使用uni-app遇到省市縣三級聯(lián)動的問題,下面這篇文章主要給大家介紹了關于Uni-App用uView組件庫中u-picker實現(xiàn)地區(qū)的省-市-區(qū)三級聯(lián)動、確認及回顯的相關資料,需要的朋友可以參考下2023-12-12用JavaScript玩轉(zhuǎn)游戲物理(一)運動學模擬與粒子系統(tǒng)
也許,三百年前的艾薩克·牛頓爵士(Sir Issac Newton, 1643-1727)并沒幻想過,物理學廣泛地應用在今天許多游戲、動畫中。2010-06-06JavaScript數(shù)組中相同的元素進行分組(數(shù)據(jù)聚合)groupBy函數(shù)詳解
今天在打算從js端時序數(shù)據(jù)庫TSDB中,按相同的類型的數(shù)據(jù)排在一起,并且取同一時間段最新的數(shù)據(jù),經(jīng)過查詢這種思想叫做數(shù)據(jù)聚合,就是返回的數(shù)據(jù)要根據(jù)一個屬性來做計算,這篇文章主要介紹了JavaScript數(shù)組中相同的元素進行分組(數(shù)據(jù)聚合)?groupBy函數(shù),需要的朋友可以參考下2023-12-12