我已经搜索了很长时间并且很难找到显示客户储蓄的模块(以$$为单位)。我希望有两种方法可以实现这一点
<小时/> 方法一:
setTimeout('countit()',1); //1 makes it display the value quickly after loading
});
function countit()
{
var amountperyear=4000000; //THIS IS THE ONLY NUMBER TO EDIT EACH YEAR
var msperyear=31536000000; //milliseconds per year
var today=new Date();
var startdate=new Date(today.getYear(),0,00); //January 1, of the current year at midnight?
var diff=Math.ceil((today.getTime()-startdate.getTime())); //Time difference in milliseconds
var newvalue=(diff*(amountperyear/msperyear)); // (# of ms) * (amount/ms)
var displayvalue=newvalue.toLocaleString(); //Convert to currency formatting
$("#mycounter").html("$"+displayvalue);
setTimeout('countit()',500); //Have it update twice per second
}
</script>
在DNN HTML模块的“内容”部分中:
<center>
This year, we've saved our customers:
<b><div id="mycounter"><i>Loading...</i></div></b>
</center>
<小时/> 新问题:
<![if !IE]>You must use IE to view this<![endif]-->
答案 0 :(得分:2)
在本地硬盘上创建一个HTML文件并将其放入其中。然后在Web浏览器中打开它。它将开始递增一个数字。您正在寻找的内容在DNN中不存在,但可以使用一些简单的Javascript来完成。这应该可以帮到你。
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
var count=5;
$(document).ready(function(){
setTimeout('countit()',1000);
});
function countit()
{
var startmoney = 10;
var today=new Date();
var startdate=new Date(2010, 10, 01); //this is actually 11-1-2010 the 10 is 0 based so actually month 11
var one_day=1000*60*60*24;
var diff=Math.ceil((today.getTime()-startdate.getTime())/(one_day));
//diff is the main factor which is the difference in days between startdate & today
count=count*2;
var newvalue=startmoney*count*diff;
$("#mycounter").html(newvalue);
setTimeout('countit()',1000);
}
</script>
</head>
<body
<div id="mycounter"></div>
</body>
</html>