如何在Asp.Net C#中创建倒数计时器 [英] How to Create CountDown Timer in Asp.Net C#

查看:101
本文介绍了如何在Asp.Net C#中创建倒数计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想显示一个秒表计时器...使用Asp.Net C#...

我引用了许多主题,还在Google中进行了搜索...
但是找不到正确的代码或解决方案..
我发现的大多数解决方案都很难实现,而有些解决方案却没有用...

我想创建像...这样的秒表.

00.00
这是HH.MM



通过点击开始按钮,从00.00开始观看手表.

并将Button的文本更改为Stop.
并再次单击它就可以停止手表.
然后将该时间保存在数据库中,并显示在给定的TextBox中....
通过单击重置"将时间重置为00.00..


我对此一无所知
因此需要一些代码作为建议..

Hi all,

I wanna diplay a Stopwatch timer ...using Asp.Net C#...

I reffer many threads and searched in google also...
But cant find proper code or solution..
Most of the solutions i found were very hard to implemnt and some of didnt worked...

I want to create stopwatch like...

00.00
which is HH.MM



In this by clicking on start button in starts the watch from 00.00

and change the text of Button to Stop.
And by click on that again it Stops the watch..
And Then Save that time in database and also display in given TextBox....
by click on Reset it resets the time to 00.00..


I haven''t any idea about this
so require some code as suggestion..

推荐答案

您是否检查了

有关类似问题,请参见以下链接

如何在ASP中实现倒数计时器.net使用c# [
See the below link for similar question

How to implement countdown timer in asp.net using c#[^].

Thanks
--RA


<!DOCTYPE html>
<html>
<body>

<p>Click the first button to display the current time, and the second button to stop the time.</p>
<button onclick="myFunction()">Try it</button>
<button onclick="myStopFunction()">Stop time</button>

<script type="text/javascript">
var myVar;

function myFunction()
{
myVar=setInterval(function(){myTimer()},1000);
}

function myTimer()
{
var d=new Date();
var t=d.toLocaleTimeString();
document.getElementById("demo").innerHTML=t;
}

function myStopFunction()
{
clearInterval(myVar);
}
</script>

<p id="demo"></p>

</body>
</html>


这篇关于如何在Asp.Net C#中创建倒数计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆