var i = 10,timer=null;
function test() {
document.getElementById("<%=Label1.ClientID %>").innerHTML = i--;
if (i < 0) clearInterval(timer);
}
window.onload = function () {
timer= setInterval("test()", 1000);
}
http://topic.csdn.net/u/20100803/09/39c84656-952c-4707-95b6-4bedea74d072.html
function test() {
document.getElementById("<%=Label1.ClientID %>").innerHTML = i--;
if (i < 0) clearInterval(timer);
}
window.onload = function () {
timer= setInterval("test()", 1000);
}
http://topic.csdn.net/u/20100803/09/39c84656-952c-4707-95b6-4bedea74d072.html
解决方案 »
- 我想用Repeater实现编辑,更新,删除的功能
- 如何动态调用一个Web services(不是添加引用的那种)
- 单点登陆
- 请教DataGrid,报表问题??
- 页面中动态添加的Panel,每个Panel中动态添加的TextBox,动态的Panel可以翻页,但是结果却不是我想要的
- 武汉的程序员你觉的悲哀吗------论武汉的软件业!--------浅谈系统架构--经历 --------接着写
- 高手帮我看一下我的代码(很短)
- 传说中的高手请进,一个非常怪异的问题,回帖有分,谢谢
- 用DataSet更新数据库
- 如何显示一个警示框
- 请问服务器识别用户的四种方法有什么区别?
- gridview buttonfied 事件
<html>
<head>
<script>
function displayCountDown(XelementID, Xdays, Xhours, Xminutes, Xseconds)
{
var days = Xdays;
var hours = Xhours;
var minutes = Xminutes;
var seconds = Xseconds;
if (hours < 10)
hours = "0" + hours;
if (minutes < 10)
minutes = "0" + minutes;
if (seconds < 10)
seconds = "0" + seconds;
var displayValue = "还剩下:" + days + "天" + hours + ":" + minutes + ":" + seconds;
document.getElementById(XelementID).innerHTML = displayValue;
var newSeconds = Xseconds - 1;
var newMinutes = Xminutes;
var newHours = Xhours;
var newDays = Xdays;
if (newSeconds < 0)
{
newSeconds = 59;
newMinutes = Xminutes - 1;
}
if (newMinutes < 0)
{
newMinutes = 59;
newHours = Xhours - 1;
}
if (newHours < 0)
{
newHours = 23;
newDays = Xdays - 1;
}
if (newDays < 0)
{
document.getElementById(XelementID).innerHTML = "时间到!";
return;
}
t = setTimeout("displayCountDown('" + XelementID + "'," + newDays + "," + newHours + "," + newMinutes + "," + newSeconds + ")", 1000);
}
function checkTime()
{
var dt=new Date();
var hour=dt.getHours();
var minute=dt.getMinutes();
var second=dt.getSeconds();
if(hour==10&&minute==0&&second==0)
displayCountDown("div1", 0, 23, 0, 0);
var t=setTimeout("checkTime()",1000);
}
</script>
</head>
<body>
<div id="div1"></div>
<script>checkTime()</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><script type="text/javascript">
var time; //计时器
var minute = 22;
var second = 60;
var showTime =minute + "分" + second + "秒"; //显示时间
function setTime(){
second--;
if(second == -1){
minute--;
second = 59;
}
if(minute == -1){
hour--;
minute = 59;
}
if((minute == 0) && (second == 0)){
clearTimeout(time); //清除计时器
}else{
showTime =minute + "分" + second + "秒";
time = setTimeout('setTime()', 1000);
}
document.all("lblTime").innerText = showTime;
}
onload = function(){
document.all("lblTime").innerText = showTime;
time = setTimeout('setTime()', 1000);
}
</script>
<body>
<span id= "lblTime"> </span>
</body>
</html>