三种js日期效果

第一种效果:

程序代码 程序代码
<SCRIPT language=JavaScript>
?? var enabled = 0;?? today = new Date();
?? var day;?? var date;
?? if(today.getDay()==0)???? day = “星期日”
?? if(today.getDay()==1)???? day = “星期一”
?? if(today.getDay()==2)???? day = “星期二”
?? if(today.getDay()==3)???? day = “星期三”
?? if(today.getDay()==4)???? day = “星期四”
?? if(today.getDay()==5)???? day = “星期五”
?? if(today.getDay()==6)???? day = “星期六”
?? document.fgColor = ” cadet”;
?? date1 = “<font size=5 face=华文新魏 color=cadet>” + (today.getYear())??+ “年” + (today.getMonth() + 1 ) + “月” + today.getDate() + “日??” + “</font>”;
?? date2 = “<font size=5 face=华文新魏 color=cadet>” +??day + “</font>”;
?? document.write(“<center>” + date1.fontsize(2) + date2.fontsize(2) + “</center>”);
??
</SCRIPT>

第二种效果:

程序代码 程序代码
<script LANGUAGE=”JavaScript”>

Stamp = new Date();
var Hours;
var Mins;
var Time;
Hours = Stamp.getHours();
if (Hours >= 12) {
Time = ” P.M.”;
}
else {
Time = ” A.M.”;
}
if (Hours > 12) {
Hours -= 12;
}
if (Hours == 0) {
Hours = 12;
}
Mins = Stamp.getMinutes();
if (Mins < 10) {
Mins = “0” + Mins;
}????
document.write(‘<font size=”5″ face=”Arial” color=cadet>’ + Hours + “:” + Mins + ‘</font>’);
document.write(‘<font size=”3″ face=”Arial” color=cadet>’ + Time + ‘</font>’);

</script>

第三种效果:

程序代码 程序代码
<script>
var d=new Date()
a=d.toLocaleString();
alert(a);
</script>

第四种效果:

程序代码 程序代码
<DIV id=jnkc></DIV>
<SCRIPT>setInterval(“jnkc.innerHTML=new Date().toLocaleString()+’ 星期’+’日一二三四五六’.charAt(new Date().getDay());”,1000);
</SCRIPT>
赞(0) 打赏
未经允许不得转载:WEB前端开发 » 三种js日期效果

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏