[Web]My Javascript function snippets

1. Get host URL

function getHostUrl() {
    var protocol = window.location.protocol;
    var host = window.location.host;
    return protocol + "//" + host;
}

2.Timer function

function doTimer() {  
    //call back
    t = setTimeout(function () { doTimer() }, 3000);
}

3.

4.

 

 

 

 

blog comments powered by Disqus