asp.net中怎么在页面上显示时间?(时,分,秒)
3个回答
2013-09-26
展开全部
ASP.NET显示时间方法2007-09-05 11:09<div align="center">
<SCRIPT language=JavaScript><!--
var enabled = 0;
var today = new Date();
var day;
var date;
var centry ;
var year;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
document.fgColor = " 000000";
centry="";
if (today.getYear()<2000 ) year=today.getYear()+1900; // centry = "1900" ;
else year=today.getYear()
date1 = year + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 " ;
date2 = "" + day;
document.write( date1+date2);
// --></SCRIPT>
</div>
<SCRIPT language=JavaScript><!--
var enabled = 0;
var today = new Date();
var day;
var date;
var centry ;
var year;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
document.fgColor = " 000000";
centry="";
if (today.getYear()<2000 ) year=today.getYear()+1900; // centry = "1900" ;
else year=today.getYear()
date1 = year + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日 " ;
date2 = "" + day;
document.write( date1+date2);
// --></SCRIPT>
</div>
2013-09-26
展开全部
<html>
<head>
<title>时间</title>
<script language="javascript">
function showtime()
{
var now_time=new Date();
var hours=now_time.getHours();
var minutes=now_time.getMinutes();
var seconds=now_time.getSeconds();
var years=now_time.getYear();
var months=now_time.getMonth();
var dates=now_time.getDate();
var days=now_time.getDay();
if(now_time.getDay()==0) days="星期日"
if(now_time.getDay()==1) days="星期一"
if(now_time.getDay()==2) days="星期二"
if(now_time.getDay()==3) days="星期三"
if(now_time.getDay()==4) days="星期四"
if(now_time.getDay()==5) days="星期五"
if(now_time.getDay()==6) days="星期六"
a=""+((hours>12)?hours-12:hours);
a +=((minutes<10)?":0":":")+minutes;
a +=((seconds<10)?":0":":")+seconds;
a +=" "+(hours>=12)?" pm":" am";
var timer=" 今天是 "+years+"年"+(months+1)+"月"+dates+"日"+" "+days+" "+a;
document.clock.show.value=timer;
setTimeout("showtime()",1000);
}
</script>
</head>
<body onload="showtime()">
<form name="clock" onsubmit="0">
<input type="text" name="show" size="50" style="background-color:lightyellow; border-width:3;">
</form>
</body>
<head>
<title>时间</title>
<script language="javascript">
function showtime()
{
var now_time=new Date();
var hours=now_time.getHours();
var minutes=now_time.getMinutes();
var seconds=now_time.getSeconds();
var years=now_time.getYear();
var months=now_time.getMonth();
var dates=now_time.getDate();
var days=now_time.getDay();
if(now_time.getDay()==0) days="星期日"
if(now_time.getDay()==1) days="星期一"
if(now_time.getDay()==2) days="星期二"
if(now_time.getDay()==3) days="星期三"
if(now_time.getDay()==4) days="星期四"
if(now_time.getDay()==5) days="星期五"
if(now_time.getDay()==6) days="星期六"
a=""+((hours>12)?hours-12:hours);
a +=((minutes<10)?":0":":")+minutes;
a +=((seconds<10)?":0":":")+seconds;
a +=" "+(hours>=12)?" pm":" am";
var timer=" 今天是 "+years+"年"+(months+1)+"月"+dates+"日"+" "+days+" "+a;
document.clock.show.value=timer;
setTimeout("showtime()",1000);
}
</script>
</head>
<body onload="showtime()">
<form name="clock" onsubmit="0">
<input type="text" name="show" size="50" style="background-color:lightyellow; border-width:3;">
</form>
</body>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-26
展开全部
时间容易提取,我就不说了, 要是能走动的,那可以用Timer来实现啊。要么用ajax也可以。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询