我必須在javascript中對計時事件做一個計時器,時間單位應該以毫秒爲單位。javascript中的計時器
我需要的東西是這樣的:
start_timer //some code.. stop_timer //and then show the ms
對不起我的英語,並感謝您的幫助!
編輯:
這個方法我試過的測試:
var d = new Date();
var time = d.toLocaleTimeString();
var myVar = window.setInterval(function(time){ time -= d.toLocaleTimeString()
return code.value = time.toString();
}, 5000);
我認爲OP可能意味着基準測試,如'console.time()'。 – gyre