代码:--------------------------------------------------------------------------------<br/>body {<br/>background-color: #D4D0C8;<br/>}<br/>.m_fieldset {<br/>padding: 0,10,5,10;<br/>text-align: center;<br/>width: 150px;<br/>}<br/>.m_legend {<br/>font-family: Tahoma;<br/>font-size: 11px;<br/>padding-bottom: 5px;<br/>}<br/>.m_frameborder {<br/>border-left: 2px inset #D4D0C8;<br/>border-top: 2px inset #D4D0C8;<br/>border-right: 2px inset #FFFFFF;<br/>border-bottom: 2px inset #FFFFFF;<br/>width: 100px;<br/>height: 19px;<br/>background-color: #FFFFFF;<br/>overflow: hidden;<br/>text-align: right;<br/>font-family: "Tahoma";<br/>font-size: 10px;<br/>}<br/>.m_arrow {<br/>width: 16px;<br/>height: 8px;<br/>font-family: "Webdings";<br/>font-size: 7px;<br/>line-height: 2px;<br/>padding-left: 2px;<br/>cursor: default;<br/>}<br/>.m_input {<br/>width: 18px;<br/>height: 14px;<br/>border: 0px solid black;<br/>font-family: "Tahoma";<br/>font-size: 9px;<br/>text-align: right;<br/>ime-mode:disabled;<br/>}<br/><br/>//Written by cloudchen, 2004/03/15<br/>function minute(name,fName)<br/>{<br/>this.name = name;<br/>this.fName = fName || "m_input";<br/>this.timer = null;<br/>this.fObj = null;<br/><br/>this.toString = function()<br/>{<br/>var objDate = new Date();<br/>var sMinute_Common = "class=\"m_input\" maxlength=\"2\" name=\""+this.fName+"\" onfocus=\""+this.name+".setFocusObj(this)\" onblur=\""+this.name+".setTime(this)\" onkeyup=\""+this.name+".prevent(this)\" onkeypress=\"if (!/[0-9]/.test(String.fromCharCode(event.keyCode)))event.keyCode=0\" onpaste=\"return false\" ondragenter=\"return false\"";<br/>var sButton_Common = "class=\"m_arrow\" onfocus=\"this.blur()\" onmouseup=\""+this.name+".controlTime()\" disabled"<br/>var str = "";<br/>str += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"<br/>str += "<tr>"<br/>str += "<td>"<br/>str += "<div class=\"m_frameborder\">"<br/>str += "<input radix=\"24\" value=\""+this.formatTime(objDate.getHours())+"\" "+sMinute_Common+">:"<br/>str += "<input radix=\"60\" value=\""+this.formatTime(objDate.getMinutes())+"\" "+sMinute_Common+">:"<br/>str += "<input radix=\"60\" value=\""+this.formatTime(objDate.getSeconds())+"\" "+sMinute_Common+">"<br/>str += ""<br/>str += ""<br/>str += "<td>"<br/>str += "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">"<br/>str += "<tr><td><button id=\""+this.fName+"_up\" "+sButton_Common+">5"<br/>str += "<tr><td><button id=\""+this.fName+"_down\" "+sButton_Common+">6"<br/>str += ""<br/>str += ""<br/>str += ""<br/>str += ""<br/>return str;<br/>}<br/>this.play = function()<br/>{<br/>this.timer = setInterval(this.name+".playback()",1000);<br/>}<br/>this.formatTime = function(sTime)<br/>{<br/>sTime = ("0"+sTime);<br/>return sTime.substr(sTime.length-2);<br/>}<br/>this.playback = function()<br/>{<br/>var objDate = new Date();<br/>var arrDate = [objDate.getHours(),objDate.getMinutes(),objDate.getSeconds()];<br/>var objMinute = document.getElementsByName(this.fName);<br/>for (var i=0;i<objMinute.length;i++)<br/>{<br/>objMinute[i].value = this.formatTime(arrDate[i])<br/>}<br/>}<br/>this.prevent = function(obj)<br/>{<br/>clearInterval(this.timer);<br/>this.setFocusObj(obj);<br/>var value = parseInt(obj.value,10);<br/>var radix = parseInt(obj.radix,10)-1;<br/>if (obj.value>radix||obj.value<0)<br/>{<br/>obj.value = obj.value.substr(0,1);<br/>}<br/>}<br/>this.controlTime = function(cmd)<br/>{<br/>event.cancelBubble = true;<br/>if (!this.fObj) return;<br/>clearInterval(this.timer);<br/>var cmd = event.srcElement.innerText=="5"?true:false;<br/>var i = parseInt(this.fObj.value,10);<br/>var radix = parseInt(this.fObj.radix,10)-1;<br/>if (i==radix&&cmd)<br/>{<br/>i = 0;<br/>}<br/>else if (i==0&&!cmd)<br/>{<br/>i = radix;<br/>}<br/>else<br/>{<br/>cmd?i++:i--;<br/>}<br/>this.fObj.value = this.formatTime(i);<br/>this.fObj.select();<br/>}<br/>this.setTime = function(obj)<br/>{<br/>obj.value = this.formatTime(obj.value);<br/>}<br/>this.setFocusObj = function(obj)<br/>{<br/>eval(this.fName+"_up").disabled = eval(this.fName+"_down").disabled = false;<br/>this.fObj = obj;<br/>}<br/>this.getTime = function()<br/>{<br/>var arrTime = new Array(2);<br/>for (var i=0;i<document.getElementsByName(this.fName).length;i++)<br/>{<br/>arrTime[i] = document.getElementsByName(this.fName)[i].value;<br/>}<br/>return arrTime.join(":");<br/>}<br/>}<br/><br/>body {<br/>background-color: #D4D0C8;<br/>}<br/>.c_fieldset {<br/>padding: 0,10,5,10;<br/>text-align: center;<br/>width: 180px;<br/>}<br/>.c_legend {<br/>font-family: Tahoma;<br/>font-size: 11px;<br/>padding-bottom: 5px;<br/>}<br/>.c_frameborder {<br/>border-left: 2px inset #D4D0C8;<br/>border-top: 2px inset #D4D0C8;<br/>border-right: 2px inset #FFFFFF;<br/>border-bottom: 2px inset #FFFFFF;<br/>background-color: #FFFFFF;<br/>overflow: hidden;<br/>font-family: "Tahoma";<br/>font-size: 10px;<br/>width:160px;<br/>height:120px;<br/>}<br/>.c_frameborder td {<br/>width: 23px;<br/>height: 16px;<br/>font-family: "Tahoma";<br/>font-size: 11px;<br/>text-align: center;<br/>cursor: default;<br/>}<br/>.c_frameborder .selected {<br/>background-color:#0A246A;<br/>width:12px;<br/>height:12px;<br/>color:white;<br/>}<br/>.c_frameborder span {<br/>width:12px;<br/>height:12px;<br/>}<br/>.c_arrow {<br/>width: 16px;<br/>height: 8px;<br/>font-family: "Webdings";<br/>font-size: 7px;<br/>line-height: 2px;<br/>padding-left: 2px;<br/>cursor: default;<br/>}<br/>.c_year {<br/>font-family: "Tahoma";<br/>font-size: 11px;<br/>cursor: default;<br/>width:55px;<br/>height:19px;<br/>}<br/>.c_month {<br/>width:75px;<br/>height:20px;<br/>font:11px "Tahoma";<br/>}<br/>.c_dateHead {<br/>background-color:#808080;<br/>color:#D4D0C8;<br/>}<br/><br/>//Written by cloudchen, 2004/03/16<br/>function calendar(name,fName)<br/>{<br/>this.name = name;<br/>this.fName = fName || "calendar";<br/>this.year = new Date().getFullYear();<br/>this.month = new Date().getMonth();<br/>this.date = new Date().getDate();<br/>//private<br/>this.toString = function()<br/>{<br/>var str = "";<br/>str += "<table border=\"0\" cellspacing=\"3\" cellpadding=\"0\" onselectstart=\"return false\">";<br/>str += "<tr>";<br/>str += "<td>";<br/>str += this.drawMonth();<br/>str += "";<br/>str += "<td align=\"right\">";<br/>str += this.drawYear();<br/>str += "";<br/>str += "";<br/>str += "<tr>";<br/>str += "<td colspan=\"2\">";<br/>str += "<div class=\"c_frameborder\">";<br/>str += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"c_dateHead\">";<br/>str += "<tr>";<br/>str += "<td>日<td>一<td>二<td>三<td>四<td>五<td>六";<br/>str += "";<br/>str += "";<br/>str += this.drawDate();<br/>str += "";<br/>str += "";<br/>str += "";<br/>str += "";<br/>return str;<br/>}<br/>//private<br/>this.drawYear = function()<br/>{<br/>var str = "";<br/>str += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";<br/>str += "<tr>";<br/>str += "<td>";<br/>str += "<input class=\"c_year\" maxlength=\"4\" value=\""+this.year+"\" name=\""+this.fName+"\" id=\""+this.fName+"_year\" readonly>";<br/>//DateField<br/>str += "<input type=\"hidden\" name=\""+this.fName+"\" value=\""+this.date+"\" id=\""+this.fName+"_date\">";<br/>str += "";<br/>str += "<td>";<br/>str += "<table cellspacing=\"2\" cellpadding=\"0\" border=\"0\">";<br/>str += "<tr>";<br/>str += "<td><button class=\"c_arrow\" onfocus=\"this.blur()\" onclick=\"event.cancelBubble=true;document.getElementById('"+this.fName+"_year').value++;"+this.name+".redrawDate()\">5";<br/>str += "";<br/>str += "<tr>";<br/>str += "<td><button class=\"c_arrow\" onfocus=\"this.blur()\" onclick=\"event.cancelBubble=true;document.getElementById('"+this.fName+"_year').value--;"+this.name+".redrawDate()\">6";<br/>str += "";<br/>str += "";<br/>str += "";<br/>str += "";<br/>str += "";<br/>return str;<br/>}<br/>//priavate<br/>this.drawMonth = function()<br/>{<br/>var aMonthName = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];<br/>var str = "";<br/>str += "<select class=\"c_month\" name=\""+this.fName+"\" id=\""+this.fName+"_month\" onchange=\""+this.name+".redrawDate()\">";<br/>for (var i=0;i<aMonthName.length;i++) {<br/>str += "<option value=\""+(i+1)+"\" "+(i==this.month?"selected":"")+">"+aMonthName[i]+"月";<br/>}<br/>str += "";<br/>return str;<br/>}<br/>//private<br/>this.drawDate = function()<br/>{<br/>var str = "";<br/>var fDay = new Date(this.year,this.month,1).getDay();<br/>var fDate = 1-fDay;<br/>var lDay = new Date(this.year,this.month+1,0).getDay();<br/>var lDate = new Date(this.year,this.month+1,0).getDate();<br/>str += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\""+this.fName+"_dateTable"+"\">";<br/>for (var i=1,j=fDate;i<7;i++)<br/>{<br/>str += "<tr>";<br/>for (var k=0;k<7;k++)<br/>{<br/>str += "<td><span"+(j==this.date?" class=\"selected\"":"")+" onclick=\""+this.name+".redrawDate(this.innerText)\">"+(isDate(j++))+"";<br/>}<br/>str += "";<br/>}<br/>str += "";<br/>return str;<br/><br/>function isDate(n)<br/>{<br/>return (n>=1&&n<=lDate)?n:"";<br/>}<br/>}<br/>//public<br/>this.redrawDate = function(d)<br/>{<br/>this.year = document.getElementById(this.fName+"_year").value;<br/>this.month = document.getElementById(this.fName+"_month").value-1;<br/>this.date = d || this.date;<br/>document.getElementById(this.fName+"_year").value = this.year;<br/>document.getElementById(this.fName+"_month").selectedIndex = this.month;<br/>document.getElementById(this.fName+"_date").value = this.date;<br/>if (this.date>new Date(this.year,this.month+1,0).getDate()) this.date = new Date(this.year,this.month+1,0).getDate();<br/>document.getElementById(this.fName+"_dateTable").outerHTML = this.drawDate();<br/>}<br/>//public<br/>this.getDate = function(delimiter)<br/>{<br/>if (!delimiter) delimiter = "/";<br/>var aValue = [this.year,(this.month+1),this.date];<br/>return aValue.join(delimiter);<br/>}<br/>}<br/> 日期(T) <br/>var c = new calendar("c");<br/>document.write(c);<br/> 时间(T) <br/>var m = new minute("m");<br/>m.play();<br/>document.write(m);<br/> 4GetDate4GetTime