-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.html
66 lines (62 loc) · 1.76 KB
/
index2.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
<!doctype html>
<html><head>
<title>file2url</title>
<!--script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script-->
<style>
textarea,input{
display:block;
border:0px solid red;
margin:25px 5% 25px 5%;
padding:25px 3% 25px 3%;
background:#f3f0f0;
color:grey;
width: 84%;
}
textarea{height:320px;background:#f9fcff;}
</style>
</head>
<body>
<div id="data1" style="display:none;"></div>
<input type="file" id="files1">
<textarea id="ta1"></textarea>
<script>
function getFileData(cbf)
{
var fin = document.getElementById('files1');
var file1 = fin.files[0];
var reader = new FileReader();
reader.onload =
function(e) {
var fe = function(e){
var str = e.target.result;
//if(cbf){cbf(str);}
// else{
/*
var w = window.open();
setTimeout(function(){
var str2 = '<textarea>'+str+'</textarea>';
w.document.write(str2);
},1000);
*/
document.getElementById('ta1').focus();
document.getElementById('ta1').innerHTML=str;
/*
setTimeout(function(){
var ta1 = document.getElementById('ta1');
ta1.focus();ta1.selectionStart=0;
ta1.selectionEnd=ta1.innerHTML.length;
},3000);
*/
// }
};
fe(e);
};
reader.readAsDataURL(file1);
document.getElementById('ta1').innerHTML='reading file; please wait...';
}
setTimeout(function(){
document.getElementById('files1').addEventListener('change', getFileData, false);
},1000);
</script>
</body>
</html>