---
title: "javascript 倒计时"
author: "microapple"
date: "2011-04-11T11:10:28Z"
tags: []
categories: ["编程语言"]
slug: "javascript"
draft: false
lastmod: "2013-03-02T11:03:42Z"
id: 997118
url: "https://microapple.iteye.com/blog/997118"
---

```js
var hhhh = 300;

	(function daoJiShi() {

		var ofm = parseInt((hhhh % 3600) / 60);
		var ofs = hhhh % 60;
		document.getElementById('timer').innerHTML = '<font size="3"  face="微软雅黑"  color="RGB(248,248,58)">制品正在解析中,还有 </font>' 
			+ '<font size="3"  face="微软雅黑"  color="red">'+ofm +'</font>'
				+ '<font size="3"  face="微软雅黑"  color="RGB(248,248,58)"> 分钟 </font>' 
				+'<font size="3"  face="微软雅黑"  color="red">'+ofs+'</font>'
					+ ' <font size="3"  face="微软雅黑"  color="RGB(248,248,58)">秒,请稍候...</font>';
		if (ofs < 0) {
			document.getElementById('timer').innerHTML = '<font size="3"  face="微软雅黑"  color="RGB(248,248,58)">倒计时结束！</font>';
			return;
		}
		;
		hhhh = hhhh - 1;
		setTimeout('daoJiShi()', 1000);
	}());
```