用JavaScript语言设计程序:在一个input框中显示当前的年.月.日,当鼠标放上去时就变换为当前的时间显示.

 我来答
寂寞哥_0512
2014-07-24 · TA获得超过149个赞
知道答主
回答量:110
采纳率:0%
帮助的人:119万
展开全部
不知道是不是你说的意思。 <html> <body> <script type="text/javascript"> var times = ""; function tick() { var year, month, date, week; var hours, minutes, seconds; var today = new Date(); year = today.getYear(); month = today.getMonth()+1; date = today.getDate(); hours = today.getHours(); minutes = today.getMinutes(); seconds = today.getSeconds(); if(today.getDay()==0) week="星期日"; if(today.getDay()==1) week="星期一"; if(today.getDay()==2) week="星期二"; if(today.getDay()==3) week="星期三"; if(today.getDay()==4) week="星期四"; if(today.getDay()==5) week="星期五"; if(today.getDay()==6) week="星期六"; if(month < 10){ month = "0"+month; } if(date < 10){ date = "0"+date; } if(hours < 10){ hours = "0"+hours; } if(minutes < 10){ minutes = "0"+minutes; } if(seconds < 10){ seconds = "0"+seconds; } document.getElementById("inday").value = year+"年"+month+"月"+date+"日"+week; times = hours+"点"+minutes+"分"+seconds+"秒"; } window.onload = tick; function getTimes() { document.getElementById("inday").value = times; } </script> <input type="text" id="inday" value="" onmouseover="getTimes()" onmouseout="tick()" size="20" /> </body> </html>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式