大概是这样的
<script>
var start_time = new Date();
var end_time = "";
var loadt = setInterval(function () {
if (document.readyState == "complete") {
showLoadTime();
}
}, 500)
function showLoadTime() {
end_time = new Date();
loadtime_span.innerHTML = "T " + (end_time.getTime() - start_time.getTime()) + " ms";
clearInterval(loadt);
}
</script>
<!-- IP -->
<span id="ip_span" align=center></span>
<script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
ip_span.innerHTML = returnCitySN["cname"] + " " + returnCitySN["cip"];
</script>
<span class="mx-2">|</span>
<span id="loadtime_span">T</span>