js導(dǎo)出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)錯(cuò)誤了'); },
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>
相關(guān)文章
Bootstrap警告(Alerts)的實(shí)現(xiàn)方法
這篇文章主要為大家詳細(xì)介紹了Bootstrap警告(Alerts)的實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-03-03Async Validator 異步驗(yàn)證使用說(shuō)明
async-validator 是一個(gè)異步驗(yàn)證的庫(kù),需要傳入要驗(yàn)證的數(shù)據(jù)和驗(yàn)證規(guī)則 ,下面通過(guò)本文給大家介紹Async Validator 異步驗(yàn)證使用說(shuō)明,需要的的朋友參考下吧2017-07-07js 時(shí)間格式與時(shí)間戳的相互轉(zhuǎn)換示例代碼
很多的新手朋友們對(duì)js中的時(shí)間格式與時(shí)間戳的轉(zhuǎn)換比較陌生,下面就為大家詳細(xì)介紹下具體的轉(zhuǎn)換步驟,感興趣的朋友可以參考下2013-12-12Uni-App用uView組件庫(kù)中u-picker實(shí)現(xiàn)地區(qū)的省-市-區(qū)三級(jí)聯(lián)動(dòng)、確認(rèn)及回顯
最近項(xiàng)目要使用uni-app遇到省市縣三級(jí)聯(lián)動(dòng)的問(wèn)題,下面這篇文章主要給大家介紹了關(guān)于Uni-App用uView組件庫(kù)中u-picker實(shí)現(xiàn)地區(qū)的省-市-區(qū)三級(jí)聯(lián)動(dòng)、確認(rèn)及回顯的相關(guān)資料,需要的朋友可以參考下2023-12-12用JavaScript玩轉(zhuǎn)游戲物理(一)運(yùn)動(dòng)學(xué)模擬與粒子系統(tǒng)
也許,三百年前的艾薩克·牛頓爵士(Sir Issac Newton, 1643-1727)并沒(méi)幻想過(guò),物理學(xué)廣泛地應(yīng)用在今天許多游戲、動(dòng)畫中。2010-06-06JavaScript數(shù)組中相同的元素進(jìn)行分組(數(shù)據(jù)聚合)groupBy函數(shù)詳解
今天在打算從js端時(shí)序數(shù)據(jù)庫(kù)TSDB中,按相同的類型的數(shù)據(jù)排在一起,并且取同一時(shí)間段最新的數(shù)據(jù),經(jīng)過(guò)查詢這種思想叫做數(shù)據(jù)聚合,就是返回的數(shù)據(jù)要根據(jù)一個(gè)屬性來(lái)做計(jì)算,這篇文章主要介紹了JavaScript數(shù)組中相同的元素進(jìn)行分組(數(shù)據(jù)聚合)?groupBy函數(shù),需要的朋友可以參考下2023-12-12