如何显示客户端经过的计时器

如何显示客户端经过的计时器

本文介绍了如何显示客户端经过的计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我是Asp.net MVC的新手,目前正在MVC 3中做一个项目.而且我需要显示div加载时的经过时间.我需要客户端经过的时间.

是否可以在Visual Studio 2010(MV3)中显示客户端经过时间的任何选项?
或必须使用Jquery.?

你能帮我吗.....


谢谢和问候,

Dileep



I am new in Asp.net MVC, and currently am doing a project in MVC 3 . And i need to show the Elapsed Time when a div is load. I need the client side Elapsed time.

Is there any option for showing Client side Elapsed time in Visual Studio 2010 (MV3)
or have to use Jquery.?

Can you please help me.....


Thanks and Regards,

Dileep

推荐答案

<script>
var seconds = null;
var ticker = null;

function startTimer( )
{
    seconds = -1;
    ticker = setInterval("tick( )", 1000);
    tick( );
}

function tick( )
{
    ++seconds;
    var secs = seconds;
    var hrs = Math.floor( secs / 3600 );
    secs %= 3600;
    var mns = Math.floor( secs / 60 );
    secs %= 60;
    var pretty = ( hrs < 10 ? "0" : "" ) + hrs

               + ":" + ( mns < 10 ? "0" : "" ) + mns

               + ":" + ( secs < 10 ? "0" : "" ) + secs;

    document.getElementById("ELAPSED").innerHTML = pretty;

}

</script>
<body onLoad="startTimer( )">
...
The elapsed time is now <span id="ELAPSED"></span>
...
</body>


这篇关于如何显示客户端经过的计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 18:52