68
2022-10-01 11:53:21 68阅读 0喜欢
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';
23
2022-09-29 23:33:05 23阅读 0喜欢
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 => {

})
783访问人次
Camila Waz 2022-10-01 16:25:55
22
2022-09-05 12:15:43 22阅读 0喜欢
//detect the language preference of the user's browser
var userLanguage = window.navigator.userLanguage || window.navigator.language;
19
2022-09-05 12:12:53 19阅读 0喜欢
//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';
    }
} 
4
2022-09-05 11:58:53 4阅读 0喜欢
function reverse_a_number(n)
{
  n = n + "";
  return n.split("").reverse().join("");
}
console.log(reverse_a_number(32243));
16
2022-09-05 11:53:49 16阅读 0喜欢
function coinFlip() {
 return (Math.floor(Math.random() * 2) == 0) ? 'heads' : 'tails';
}
7
2022-09-05 11:45:55 7阅读 0喜欢
window.navigator.userAgent
6
2022-09-05 08:47:20 6阅读 0喜欢
 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();
43
2022-09-05 08:27:19 43阅读 0喜欢
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();  
}
9
2022-09-05 08:26:25 9阅读 0喜欢
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();