let num = 0
const imageObj = new Image();
const timer = setInterval(() => {
document.getElementById('time').innerHTML = num++
imageObj.onload = () => {
document.getElementById('img').src = imageObj.src
console.log(num)
clearInterval(timer);
}
},1000)
imageObj.src = 'http://good1230.com/templates/test_img/1.jpg';
const text = `日志异常内容:${err}`
const blob = new Blob([text], {type: 'text/plain'});
let formData = new FormData();
formData.append("file", blob, `${new Date().getTime()}.txt`);
uploadException(formData).then(res => {
})
//detect the language preference of the user's browser
var userLanguage = window.navigator.userLanguage || window.navigator.language;
//gets the type of browser
function detectBrowser() {
if((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1 ) {
return 'Opera';
} else if(navigator.userAgent.indexOf("Chrome") != -1 ) {
return 'Chrome';
} else if(navigator.userAgent.indexOf("Safari") != -1) {
return 'Safari';
} else if(navigator.userAgent.indexOf("Firefox") != -1 ){
return 'Firefox';
} else if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) {
return 'IE';//crap
} else {
return 'Unknown';
}
}
function sleep(milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
async function fun() {
document.write('Hello World');
for (let i = 1; i <=10 ; i++) {
await sleep(2000);
document.write( i + " " + "Welcome to the javaTpoint.com" + " " + "</br>");
}
}
fun();
function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;
//define the file type to text/csv
csvFile = new Blob([csv], {type: 'text/csv'});
downloadLink = document.createElement("a");
downloadLink.download = filename;
downloadLink.href = window.URL.createObjectURL(csvFile);
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
downloadLink.click();
}
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(csv);
hiddenElement.target = '_blank';
//provide the name for the CSV file to be downloaded
hiddenElement.download = 'Famous Personalities.csv';
hiddenElement.click();