首页 | IT新闻 | 硬件 | 操作系统 | 开发 | 网络编程 | 数据库 | 热门框架 | 网络安全 | 组网 | 建站指南 | 网页制作 | 特效 | 实用技巧 | 服务器 | 办公 | QQ | 探索 | 社区

  • 技术部落
  • 部落首页 > 网页特效 > 正文
  • 八种风格的时间日期
      2007-2-25  来源:网络资源  编辑:Jsbulo  热度:


    下面框中为脚本显示区

    风格一

    星期一,7月10日,2006年

    风格二

    2:11:34下午

    风格三

    星期一,7月10日,2006年 2:11:34下午

    风格四

    7/10/06

    风格五:

    14:11:34

    风格六:

    Mon Jul 10 14:11:34 UTC+0800 2006

    风格七

    Microsoft Internet Explorer

    风格八:

    4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

    脚本说明:
    第一步:把如下代码加入<head>区域中
    <SCRIPT language=javascript author=luxiaoqing><!--
    function initArray(){for(i=0;i<initArray.arguments.length;i++)
    this[i]=initArray.arguments[i];}var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");today=new Date();hrs=today.getHours();min=today.getMinutes();sec=today.getSeconds();clckh=""+((hrs>12)?hrs-12:hrs);
    clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;clck=(hrs>=12)?"下午":"上午";var stnr="";var ns="0123456789";var a="";

    //-->

    </SCRIPT>
    第二步:把如下代码加入区域中
    <SCRIPT language=javascript><!--
    function getFullYear(d){//d is a date object
    yr=d.getYear();if(yr<1000)
    yr+=1900;return yr;}document.write("<table width=486>");//don’t delete this line

    /* 每一段代表一种风格,不需要的删除即可*/

    document.write("<TR><TD VALIGN=TOP><P>风格一<P></TD><TD VALIGN=TOP>"+isnDays[today.getDay()]
    +","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"
    +getFullYear(today)+"年<P>");document.write("<TR><TD VALIGN=TOP>风格二<P></TD><TD VALIGN=TOP>"+clckh+":"+clckm
    +":"+clcks+""+clck+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格三<P></TD><TD VALIGN=TOP>"
    +isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""
    +today.getDate()+"日,"+getFullYear(today)+"年 "+clckh+":"+clckm+":"
    +clcks+""+clck+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格四<P></TD><TD VALIGN=TOP>"
    +(today.getMonth()+1)+"/"+today.getDate()+"/"
    +(getFullYear(today)+"").substring(2,4)+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格五:<P></TD><TD VALIGN=TOP>"+hrs+":"+clckm+":"+clcks+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格六:<P></TD><TD>"+today+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格七<P></TD><TD>"+navigator.appName+"<P></TD></TR>");document.write("<TR><TD VALIGN=TOP>风格八:<P></TD><TD VALIGN=TOP>"+navigator.appVersion+"<P></TD></TR>");document.write("</table>"); // don’t delete this line
    //-->

    </SCRIPT>