Ⅰ 怎樣在設計網站中插入時間
插入以下代碼:
今天是: <script language="JavaScript" type="text/javascript">
var day="";
var month="";
var ampm="";
var ampmhour="";
var myweekday="";
var year="";
mydate=new Date();
myweekday=mydate.getDay();
mymonth=mydate.getMonth()+1;
myday= mydate.getDate();
myyear= mydate.getYear();
year=(myyear > 200) ? myyear : 1900 + myyear;
if(myweekday == 0)
weekday=" 星期日 ";
else if(myweekday == 1)
weekday=" 星期一 ";
else if(myweekday == 2)
weekday=" 星期二 ";
else if(myweekday == 3)
weekday=" 星期三 ";
else if(myweekday == 4)
weekday=" 星期四 ";
else if(myweekday == 5)
weekday=" 星期五 ";
else if(myweekday == 6)
weekday=" 星期六 ";
document.write(year+"年"+mymonth+"月"+myday+"日 "+weekday);
</script>
頁面顯示為:今天是: 2010年6月20日 星期日
Ⅱ 如何在網頁中添加系統時間
Date date = new Date();
var year = date.getYear();
var month = date.getMonth();
var day = date.getDay();
var nowDate = year + "-" + month +"-"+day;
然後將這個變數值放在html中的span或者其他控制項,如果需要動態顯示時間,需要使用setTimeout()方法並且在方法內部繼續調用方法,這樣會一直調用顯示。
Ⅲ 網頁中怎樣插入時間代碼
用ASP就可以實現,如下,那個國旗的圖片我就省去了
<%
Functionftime(n)
dimi
i=hour(time)
ifi+n>=24then
i=i+n-24
else
i=i+n
endif
ftime=i&":"&minute(time)&":"&second(time)&""
EndFunction
response.write"NewYork"&ftime(11)&"London"&ftime(16)
&"Frankfurt"&ftime(17)&"Singapore"&ftime(0)&"Tokyo
"&ftime(1)&"Korea"&ftime(1)&"Beijing"&ftime(0)
%>
Ⅳ 如何在網頁中添加時間
function Year_Month(){
var now = new Date();
var yy = now.getYear();
var mm = now.getMonth()+1;
var cl = '<font color="#0000df">';
if (now.getDay() == 0) cl = '<font color="#c00000">';
if (now.getDay() == 6) cl = '<font color="#00c000">';
return(cl + yy + '年' + mm + '月</font>'); }
function Date_of_Today(){
var now = new Date();
var cl = '<font color="#ff0000">';
if (now.getDay() == 0) cl = '<font color="#c00000">';
if (now.getDay() == 6) cl = '<font color="#00c000">';
return(cl + now.getDate() + '</font>'); }
function Day_of_Today(){
var day = new Array();
day[0] = "星期日";
day[1] = "星期一";
day[2] = "星期二";
day[3] = "星期三";
day[4] = "星期四";
day[5] = "星期五";
day[6] = "星期六";
var now = new Date();
var cl = '<font color="#0000df">';
if (now.getDay() == 0) cl = '<font color="#c00000">';
if (now.getDay() == 6) cl = '<font color="#00c000">';
return(cl + day[now.getDay()] + '</font>'); }
function CurentTime(){
var now = new Date();
var hh = now.getHours();
var mm = now.getMinutes();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
var clock = hh+':';
if (mm < 10) clock += '0';
clock += mm+':';
if (ss < 10) clock += '0';
clock += ss;
return(clock); }
function refreshCalendarClock(){
document.all.calendarClock1.innerHTML = Year_Month();
document.all.calendarClock2.innerHTML = Date_of_Today();
document.all.calendarClock3.innerHTML = Day_of_Today();
document.all.calendarClock4.innerHTML = CurentTime(); }
var webUrl = webUrl;
document.write('<table border="0" cellpadding="0" cellspacing="0"><tr><td>');
document.write('<table id="CalendarClockFreeCode" border="0" cellpadding="0" cellspacing="0" width="70" height="90" ');
document.write('style="position:absolute;visibility:hidden" bgcolor="#eeeeee">');
document.write('<tr><td align="center"><font ');
document.write('style="cursor:hand;color:#ff0000;font-family:宋體;font-size:14pt;line-height:120%" ');
if (webUrl != 'netflower'){
document.write('</td></tr><tr><td align="center"><font ');
document.write('style="cursor:hand;color:#2000ff;font-family:宋體;font-size:10pt;line-height:110%" ');
}
document.write('</td></tr></table>');
document.write('<table border="0" cellpadding="0" cellspacing="0" width="71" bgcolor="#C0C0C0" height="90">');
document.write('<tr><td valign="top" width="100%" height="100%">');
document.write('<table border="1" cellpadding="0" cellspacing="0" width="70" class="a4" height="89">');
document.write('<tr><td align="center" width="100%" height="100%" >');
document.write('<font id="calendarClock1" style="font-family:宋體;font-size:9pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock2" style="color:#ff0000;font-family:Arial;font-size:18pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock3" style="font-family:宋體;font-size:12pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock4" style="color:#100080;font-family:宋體;font-size:10pt;line-height:120%"><b> </b></font>');
document.write('</td></tr></table>');
document.write('</td></tr></table>');
document.write('</td></tr></table>');
setInterval('refreshCalendarClock()',1000);
Ⅳ 請教如何在我做的網頁中加入時間.
<SCRIPTLANGUAGE="JavaScript">
functionshowDate(){
vartoday=newDate();
varday=today.getDate();
varmonth=today.getMonth()+1;
varyear=today.getYear();
varweek=today.getDay();
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="星期六";
vardate="■今天是:"+year+"年"+month+"月"+day+"日"+week;
document.getElementById('currDate').innerText=date;
}
</SCRIPT>
<bodyonLoad="showDate()">
這是我做的一個系統裡面的,你可以試試看
這個圖片傳上來就走形了,反正就這個效果
Ⅵ 在網頁中如何插入北京時間,就像下面的效果
1、用DHTML設計界面;
2、設法獲得北京時間。如果有困難,使用伺服器時間或本地時間也行,但會有誤差;
3、設置顯示時間的數字字體,或用圖片代替也可;
4、用JavaScript編寫相關的控製程序。
Ⅶ 如何在html網頁右上角添加時鍾或者時間
把這個DIV放到你想放到的地方,然後修改一下樣式就可以了
<style>
.time{...........................}
</style>
<div class="time">
<SCRIPT language=JavaScript>
<!--
tmpDate = new Date();
date = tmpDate.getDate();
month= tmpDate.getMonth() + 1 ;
year= tmpDate.getYear();
document.write(year);
document.write("年");
document.write(month);
document.write("月");
document.write(date);
document.write("日 ");
myArray=new Array(6);
myArray[0]="星期日 "
myArray[1]="星期一 "
myArray[2]="星期二 "
myArray[3]="星期三 "
myArray[4]="星期四 "
myArray[5]="星期五 "
myArray[6]="星期六 "
weekday=tmpDate.getDay();
if (weekday==0 | weekday==6)
{
document.write(myArray[weekday])
}
else
{
document.write(myArray[weekday])
}
// -->
</SCRIPT>
</div>
Ⅷ 如何在網頁上加入實時的時間
<html>
<head>
<script language="javascript">
function clockShow(){
var now= new Date()();
var hour= now.getHours();
var minute=now.getMinutes();
var second=now.getSeconds();
document.myform.myclock.value=hour+":"+minute+":"+second+" ";
var myTime = setTimeout("clockShow()",1000);
}
</script>
</head>
<body onLoad="clockShow()">
<form NAME="myform">
<INPUT type="text" name="myclock" >
</form>
</body>
</html>
Ⅸ 網頁製作中如何添加時間,不要日期!~
asp
用time
<%=time%>
普通網頁用js
<SCRIPT language=Javascript1.2>
<!--
var c = "<font color='#000000'>"
var d = "</font>"
if(navigator.appName == "Netscape")
{
document.write('<layer id="clock3"></layer>');
}
if (navigator.appVersion.indexOf("MSIE") != -1)
{
document.write('<span id="clock3"></span>');
}
function showclock3()
{
var date3 = new Date();
var hour3 = date3.getHours();
var min3 = date3.getMinutes();
var sec3 = date3.getSeconds();
var col3 = ":";
var x3;
x3=hour3;
if (x3>=24) x3=x3-24;
if (min3<=9) min3="0"+min3;
if (sec3<=9) sec3="0"+sec3;
if(navigator.appName == "Netscape")
{
document.clock3.document.write(c+x3+col3+min3+col3+sec3+d);
document.clock3.document.close();
}
if (navigator.appVersion.indexOf("MSIE") != -1)
{
clock3.innerHTML =c+x3+col3+min3+col3+sec3+d;
}
}
setInterval("showclock3()",1000);
//-->
</SCRIPT>
Ⅹ 怎樣在網頁中插入時間
是的,只能用代碼,不用代碼還能用什麼?
先把滑鼠定義在你想要顯示時間的單元格中,然後切換到代碼插入以下代碼
<script language=JavaScript>
<!-- document.write
now = new Date()
document.write
if (now.getDay() == 5)document.write("星期五")
if (now.getDay() == 6)document.write("星期六")
if (now.getDay() == 0)document.write("星期日")
if (now.getDay() == 1)document.write("星期一")
if (now.getDay() == 2)document.write("星期二")
if (now.getDay() == 3)document.write("星期三")
if (now.getDay() == 4)document.write("星期四")
document.write
</script>
<script lange=JavaScript>
<!--tmpDate=newDate();
date=tmpDate.getDate();
month=tmpDate.getMonth()+1;
year=tmpDate.getYear();
document.write("今天是:");
document.write(year);
document.write("年");
document.write(month);
document.write("月");
document.write(date);
document.write("日");
</script>
如果不懂加我QQ:233240208,我教你啊!