md2essay/js/Downloadify/test.html

85 lines
2.9 KiB
HTML
Raw Normal View History

2015-04-06 06:19:50 -04:00
<!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>
<style type="text/css" media="screen">
body {background: #fff; width: 500px; margin: 20px auto;}
label, input, textarea, h1, h2, p { font-family: Arial, sans-serif; font-size: 12pt;}
input, textarea { border: solid 1px #aaa; padding: 4px; width: 98%;}
label { font-weight: bold;}
h1 { font-size: 30pt; font-weight: bold; letter-spacing: -1px;}
h2 { font-size: 14pt;}
pre { overflow: auto; padding: 10px; background: #222; color: #ccc;}
</style>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/downloadify.min.js"></script>
</head>
<body onload="load();">
<h1>Downloadify Example</h1>
<p>More info available at the <a href="http://github.com/dcneiner/Downloadify">Github Project Page</a></p>
<form>
<p>
<label for="filename">Filename</label><br />
<input type="text" name="filename" value="testfile.txt" id="filename" />
</p>
<p>
<label for="data">File Contents</label><br />
<textarea cols="60" rows="10" name="data" id="data">
Whatever you put in this text box will be downloaded and saved in the file. If you leave it blank, no file will be downloaded</textarea>
</p>
<p id="downloadify">
You must have Flash 10 installed to download this file.
</p>
</form>
<script type="text/javascript">
function load(){
Downloadify.create('downloadify',{
filename: function(){
return document.getElementById('filename').value;
},
data: function(){
return document.getElementById('data').value;
},
onComplete: function(){ alert('Your File Has Been Saved!'); },
onCancel: function(){ alert('You have cancelled the saving of this file.'); },
onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); },
swf: 'media/downloadify.swf',
downloadImage: 'images/download.png',
width: 100,
height: 30,
transparent: true,
append: false
});
}
</script>
<h2>Downloadify Invoke Script For This Page</h2>
<pre>
Downloadify.create(&#x27;downloadify&#x27;,{
filename: function(){
return document.getElementById(&#x27;filename&#x27;).value;
},
data: function(){
return document.getElementById(&#x27;data&#x27;).value;
},
onComplete: function(){
alert(&#x27;Your File Has Been Saved!&#x27;);
},
onCancel: function(){
alert(&#x27;You have cancelled the saving of this file.&#x27;);
},
onError: function(){
alert(&#x27;You must put something in the File Contents or there will be nothing to save!&#x27;);
},
swf: &#x27;media/downloadify.swf&#x27;,
downloadImage: &#x27;images/download.png&#x27;,
width: 100,
height: 30,
transparent: true,
append: false
});
</pre>
</body>
</html>