返回列表 发帖

[交流] 想大家帮我修改一下日期插件!

<script language="Javascript">
function today()
{
setTimeout("today()",1000);
var today = new Date();
var week = new Array
("星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
var display= today.toLocaleString()+"  "+week[today.getDay()];
status=display;
}
today();
</script>

就是上面,如何修改成不要年份。

本帖最后由 qcqtye 于 2009-3-26 16:44 编辑

<script LANGUAGE="Javascript">
  <!--
  var flasher = false
  // calculate current time, determine flasher state,
  // and insert time into status bar every second
  function updateTime() {
   var now = new Date()
   var theHour = now.getHours()
   var theMin = now.getMinutes()
   var theTime = "" + ((theHour > 12) ? theHour - 12 : theHour)
   theTime += ((theMin < 10) ? ":0" : ":") + theMin
   theTime += ((flasher) ? "  " : " :")
   theTime += (theHour >= 12) ? " 下午" : " 上午"
   flasher = !flasher
   window.status = theTime
   // recursively call this function every second to keep timer going
   timerID = setTimeout("updateTime()",1000)
  }
  //-->
updateTime()
  </script>

TOP

本帖最后由 qcqtye 于 2009-3-26 16:57 编辑

<script language="JavaScript">
var osd = " "
osd +="";
var timer;
var msg = "";
function scrollMaster () {
msg = customDateSpring(new Date())
clearTimeout(timer)
msg += " " + showtime() + " " + osd
for (var i= 0; i < 100; i++){
msg = " " + msg;
}
scrollMe()
}
function scrollMe(){
window.status = msg;
msg = msg.substring(1, msg.length) + msg.substring(0,1);
timer = setTimeout("scrollMe()", 200);
}
function showtime (){
var now = new Date();
var hours= now.getHours();
var minutes= now.getMinutes();
var seconds= now.getSeconds();
var months= now.getMonth();
var dates= now.getDate();
var years= now.getYear();
var timeValue = ""
timeValue += ((months >9) ? "" : " ")
timeValue += ((dates >9) ? "" : " ")
timeValue = ( months +1)
timeValue +="/"+ dates
timeValue +="/"+ years
var ap="上午"
if (hours == 12) {
ap = "下午"
}
if (hours == 0) {
hours = 12
}
if(hours >= 13){
hours -= 12;
ap="下午"
}
var timeValue2 = " " + hours
timeValue2 += ((minutes < 10) ? ":0":":") + minutes + " " + ap
return timeValue2;
}
function MakeArray(n) {
this.length = n
return this
}
monthNames = new MakeArray(12)
monthNames[1] = "1"
monthNames[2] = "2"
monthNames[3] = "3"
monthNames[4] = "4"
monthNames[5] = "5"
monthNames[6] = "6"
monthNames[7] = "7"
monthNames[8] = "8"
monthNames[9] = "9"
monthNames[10] = "10"
monthNames[11] = "11"
monthNames[12] = "12"
daysNames = new MakeArray(7)
daysNames[1] = "星期日"
daysNames[2] = "星期一"
daysNames[3] = "星期二"
daysNames[4] = "星期三"
daysNames[5] = "星期四"
daysNames[6] = "星期五"
daysNames[7] = "星期六"
function customDateSpring(oneDate) {
var theDay = daysNames[oneDate.getDay() +1]
var theDate =oneDate.getDate()
var theMonth = monthNames[oneDate.getMonth() +1]
var dayth="日"
if ((theDate == 1) || (theDate == 21) || (theDate == 31)) {
dayth="日";
}
if ((theDate == 2) || (theDate ==22)) {
dayth="日";
}
if ((theDate== 3) || (theDate == 23)) {
dayth="日";
}
return theMonth + "月" + theDate + dayth + " " + theDay  
}
scrollMaster();
</script>

TOP

返回列表