var result = '0,0.' + Array(decimalPlace + 1).join('0')
result = result.replace(/\.\s*$/, "");
decimalPlace 0: "0,0"decimalPlace 1: "0,0.0"
decimalPlace 2: "0,0.00"
參考:
var result = '0,0.' + Array(decimalPlace + 1).join('0')
result = result.replace(/\.\s*$/, "");
decimalPlace 0: "0,0"<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 = '';
}
}