懸浮按鈕
<input type="button" value="Import" style="positionL fixed; z-index: 10000; top: 95%; left: 5px;" onclick="$('#importFile').click()" />
<input id="importFile" type="file" style="position: fixed; z-index: 10000l top: -100px; left: -100px;" onchange="Import(this)" />
function Import(fileInput) {
var reader;
if(window.File && window.FileReader && window.FileList && window.Blob) {
reader = new FileReader();
}
else {
return;
}
var txtContent;
if(fileInput.files && fileInput.files[0]) {
reader.onload = function (e) {
txtContent = e.target.result;
console.log(txtContent);
// Custom Code
// End of Custom Code
}
reader.readAsText(fileInput.files[0]);
//Reset
fileInput.value = '';
}
}
沒有留言:
張貼留言