js定时器

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
 
<body>
<span id="test">5</span>
</body>
</html>
<script type="text/javascript" src="http://www.dcopxiolet.com/homes/Tpl/Style/js/jquery-1.js"></script>
 
<script type="text/javascript">
var messageTime = 5;
 
function messageHide()
{
	if(messageTime > 0)
	{
		messageTime--;
		$('#test').text(messageTime);
		var message = setTimeout(messageHide,1000);
	}else
	{
		alert(1);
		clearTimeout(message);
 
	}
}
messageHide();
</script>

购买后,页面中间显示购买成功/购买失败按钮HTML代码

<div style="width:250px;
	height:54px;
	line-height:54px;
	background-color:#36a8fe;
	color:#ffffff;
	-webkit-border-radius: 35px;
    -moz-border-radius: 35px;
    border-radius: 35px;
	font-size:24px;
	text-align:center;
    margin-left:auto;
	margin-right:auto;
    position:absolute;top:50%;left:50%;display:none;" id="topup_history_link">
        <a href="/buy_history" style="color:#ffffff;">点击查看付费结果</a>
    </div>

默认是不显示的,当用户点击购买按钮跳转到支付宝或其它支付工具页面时,用JS把这个按钮在当前页面的正中间显示出来即可。

JS上下滚动(转)

http://www.jb51.net/article/24287.htm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>test</title> 
<style type="text/css"> 
#textHeight{line-height:25px; height:25px; overflow:hidden; width:150px; font-size:12px; border:solid 1px #666;} 
</style> 
<script language="javascript" type="text/javascript"> 
function ScrollText(content){ 
this.Delay=10; 
this.Amount=1; 
this.Direction="up"; 
this.Timeout=1000; 
this.ScrollContent=this.gid(content); 
this.ScrollContent.innerHTML += this.ScrollContent.innerHTML; 
this.ScrollContent.onmouseover = this.GetFunction(this,"Stop"); 
this.ScrollContent.onmouseout = this.GetFunction(this,"Start"); 
} 
 
ScrollText.prototype.gid=function(element){ 
return document.getElementById(element); 
} 
ScrollText.prototype.Stop=function(){ 
clearTimeout(this.AutoScrollTimer); 
clearTimeout(this.ScrollTimer); 
} 
ScrollText.prototype.Start=function(){ 
clearTimeout(this.AutoScrollTimer); 
this.AutoScrollTimer=setTimeout(this.GetFunction(this,"AutoScroll"),this.Timeout); 
} 
 
ScrollText.prototype.AutoScroll=function(){ 
if(this.Direction=="up"){ 
if(parseInt(this.ScrollContent.scrollTop)>=parseInt(this.ScrollContent.scrollHeight)/2){ 
this.ScrollContent.scrollTop=0; 
clearTimeout(this.AutoScrollTimer); 
this.AutoScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Timeout); 
return; 
} 
this.ScrollContent.scrollTop += this.Amount; 
}else 
{ 
if(parseInt(this.ScrollContent.scrollTop) <= 0) 
{ 
this.ScrollContent.scrollTop = parseInt(this.ScrollContent.scrollHeight) / 2; 
} 
this.ScrollContent.scrollTop -= this.Amount; 
} 
if(parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0) 
{ 
this.ScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Delay); 
} 
else 
{ 
this.AutoScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Timeout); 
} 
} 
 
ScrollText.prototype.GetFunction=function(variable,method){ 
return function() 
{ 
variable[method](); 
} 
} 
</script> 
</head> 
 
<body> 
<div id="textHeight" title="xx"> 
<a href="#">博客园</a> <span> | </span> 
<a href="#">脚本之家</a> <span> | </span> 
<a href="#">csdn</a> <span> | </span> 
<a href="#">蓝色理想</a> <span> | </span> 
<a href="#">51js</a> <span> | </span> 
</div> 
<script> 
var scrollup = new ScrollText("textHeight"); 
scrollup.Start(); 
</script> 
</body> 
</html>

12 My97DatePicker日期时间选择JS

先下载My97DatePicker然后引用My97DatePicker文件夹下的WdatePicker.js即可使用,效果不错.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<form  method="post" action='#'>
<table>
<tr>
	<td>
		<input type="text"  readonly onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
		<input type="text"  readonly onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
	</td>
</tr>
</table>
</body>
</html>