forked from dcneiner/Downloadify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
84 lines (82 loc) · 2.93 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!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('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
});
</pre>
</body>
</html>