var box =['nihao','hello',new Date()];
box.toLocaleString()
box.toLocaleDateString()
box.toLocaleTimeString()
var box=[0,1,10,15,5];
alert(box.sort(compare));
function compare(value1,value2){
if(value1<value2){
return -1;
}else if(value>value2){
return 1;
}else{
return 0;
}
}
var RemainTime = "2013-11-10 22:11";
var endtimeStr = RemainTime.replace(/-/g,"/"); var endtime=new Date(endtimeStr); var nowtime = new Date(); var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000); d=parseInt(leftsecond/3600/24); h=parseInt((leftsecond/3600)%24); m=parseInt((leftsecond/60)%60); s=parseInt(leftsecond%60);$("#timerSet").html("剩余时间:<b>"+d+"</b> 天 <b>"+h+"</b> 时 <b>"+m+"</b> 分 <b>"+s+"</b> 秒 ");
math.floor向下舍入
math.ceil向上舍入
math.round四舍五入
1到10随即数
math.floor(math.random()*10+1) 范围是1~10+1-1
5到10随机数
10-5+1=6
math.floor(math.random()*6+5) 范围是5~10