52、状态栏显示全部时间

52、状态栏显示全部时间

脚本说明:

第一步:把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

var today = new Date();

var Day = today.getDay();

var Date = today.getDate();

var Mnth = today.getMonth();

var Hrs = today.getHours();

var Mins = today.getMinutes();

 

//********** THE SWITCH *************

//11 = Date & Time. 10 = Date. 01 = Time.

var DTswitch = 11;

 

var DayNam = new Array(

"Sunday",

"Monday",

"Tuesday",

"Wednesday",

"Thursday",

"Friday",

"Saturday");

 

var MnthNam = new Array(

"January",

"February",

"March",

"April",

"May",

"June",

"July",

"August",

"September",

"October",

"November",

"December");

var Date = Date + "th"

if (Date == 1 || Date == 21 || Date == 31) {Date= Date + "st";}

if (Date == 2 || Date == 22) {Date= Date + "nd";}

if (Date == 3 || Date == 23) {Date= Date + "rd";}

if (Hrs < 10) {Hrs = "0" + Hrs;}

if (Mins < 10) {Mins = "0" + Mins;}

var DateIt = DayNam[today.getDay()] + " " + Date + " " + MnthNam[Mnth];

var TimeIt = Hrs+":"+Mins;

if (DTswitch == 11) {var DateTime = DateIt + "  " + TimeIt;}

if (DTswitch == 10) {var DateTime = DateIt;}

if (DTswitch == 01) {var DateTime = TimeIt;}

window.status=DateTime;

//  End -->

</script>

 

 

第二步:把<body>中的内容改为:

<body  onLoad="window.status=DateTime;">

Write a comment

Comments: 0