㈠ js如何制作网页时钟

<script language="javascript"> function startTime(){ var today=new Date() var y=today.getFullYear() var M=today.getMonth() var d=today.getDate() var h=today.getHours() var m=today.getMinutes() var s=today.getSeconds() M=jia(M) d=jia(d) m=jia(m) s=jia(s) document.getElementById('sj').innerhtml=y+"-"+M+"-"+d+":"+h+":"+m+":"+s t=setTimeout('startTime()',500) } function jia(i){ if(i<10){ i="0"+i; } return i; } </script>

㈡ 如何在网页中插入时钟

<html>
<head>
<title>倒计时</title>
<body>
<script language=JavaScript>
var now = new Date("11/26/2006 " + 10 + ":" + 30 + ":" + 30);

function GetServerTime()
{
var urodz = new Date("11/30/2006 11:38:33");
now.setTime(now.getTime()+250);
days = (urodz - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (urodz - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (urodz - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (urodz - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
document.getElementById("date").innerHTML = daysRound;
document.getElementById("time").innerHTML = hoursRound + ":" + minutesRound + ":" + secondsRound;
}
setInterval("GetServerTime()",250);
</script>

距离********还有<span id="date"></span> <span class="white14b">天</span> <span id="time"></span>
</body>
</html>

=================================================
<script LANGUAGE="JavaScript">
var urodz= new Date("June 07,2007");
var s="时间";
var now = new Date();
var ile = urodz.getTime() - now.getTime();
var dni = Math.floor(ile / (1000 * 60 * 60 * 24));
if (dni > 1)
document.write("正式倒计时!</br>今天离"+s+"还有"+dni +"天!")
else if (dni == 1)
document.write("还有2天了哦!")
else if (dni == 0)
document.write("只有最后1天了!")
else
document.write("嘿嘿,到了!");
</script>

㈢ 怎么调整网页时间 使网页上的时间与电脑上本地时间不一样

1,首先,打开浏览器,并进入一个带有时间显示的网页。

㈣ DW网页怎么设计一个时钟

<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>使用canvas元素绘制指针式动画时钟</title>
<script type="text/javascript">
var canvas;
var context;
//页面装载
function window_onload()
{
canvas=document.getElementById("canvas");//获取canvas元素
context=canvas.getContext('2d');//获取canvas元素的图形上下文对象
setInterval("draw()",1000);//每隔一秒重绘时钟,重新显示时间
}
//绘制时钟
function draw()
{
var radius=Math.min(canvas.width / 2, canvas.height / 2) -25;//时钟罗盘半径
var centerx=canvas.width/2;//时钟中心横坐标
var centery=canvas.height/2;//时钟中心纵坐标
context.clearRect(0,0,canvas.width,canvas.height);//擦除之前所绘时钟
context.save();//保存当前绘制状态

//绘制时钟圆盘
context.fillStyle = '#efefef';//时钟背景色
context.strokeStyle = '#c0c0c0';//时钟边框颜色
context.beginPath();//开始创建路径
context.arc(centerx,centery,radius, 0,Math.PI*2, 0);//创建圆形罗盘路径
context.fill();//用背景色填充罗盘
context.stroke();//用边框颜色绘制罗盘边框
context.closePath();//关闭路径
context.restore();//恢复之前保存的绘制状态

//绘制时钟上表示小时的文字
var r = radius - 10;//缩小半径,因为要将文字绘制在时钟内部
context.font= 'bold 16px 宋体';//指定文字字体
Drawtext('1', centerx + (0.5 * r), centery - (0.88 * r));
Drawtext('2', centerx + (0.866 * r), centery - (0.5 * r));
Drawtext('3', centerx + radius - 10,centery);
Drawtext('4', centerx + (0.866 * r), centery + (0.5 * r));
Drawtext('5', centerx + (0.5 * r), centery + (0.866 * r));
Drawtext('6', centerx, centery + r);
Drawtext('7', centerx - (0.5 * r), centery + (0.866 * r));
Drawtext('8', centerx - (0.866 * r), centery + (0.49 * r));
Drawtext('9', centerx - radius + 10, centery);
Drawtext('10',centerx - (0.866 * r),centery - (0.50 * r));
Drawtext('11', centerx - (0.51 * r), centery - (0.88 * r));
Drawtext('12', centerx, 35);
//绘制时钟指针
var date=new Date();//获取需要表示的时间
var h = date.getHours();//获取当前小时
var m = date.getMinutes();//获取当前分钟
var s=date.getSeconds();//获取当前秒
var a = ((h/12) *Math.PI*2) - 1.57 + ((m / 60) * 0.524);//根据当前时间计算指针角度

context.save();//保存当前绘制状态
context.fillStyle='black'; //指定指针中心点的颜色
context.beginPath();//开始创建路径
context.arc(centerx,centery,3,0,Math.PI * 2, 0);//创建指针中心点的路径
context.closePath();//关闭路径
context.fill();//填充指针中心点
context.lineWidth=3;//指定指针宽度
context.fillStyle='darkgray';//指定指针填充颜色
context.strokeStyle='darkgray';//指定指针边框颜色
context.beginPath();//开始创建路径
//绘制小时指针
context.arc(centerx,centery,radius - 55, a + 0.01, a, 1);
context.lineTo(centerx,centery);
//绘制分钟指针
context.arc(centerx,centery,radius - 40, ((m/60) * 6.27) - 1.57, ((m/60) * 6.28) - 1.57, 0);
context.lineTo(canvas.width / 2, canvas.height / 2);
//绘制秒钟指针
context.arc(centerx,centery,radius - 30, ((s/60) * 6.27) - 1.57, ((s/60) * 6.28) - 1.57, 0);
context.lineTo(centerx,centery);
context.closePath();//关闭路径
context.fill();//填充指针
context.stroke();//绘制指针边框
context.restore();//恢复之前保存的绘制状态

//指定时钟下部当前时间所用的字符串,文字格式为hh:mm:dd
var hours = String(h);
var minutes = String(m);
var seconds = String(s);
if (hours.length == 1) h = '0' + h;
if (minutes.length == 1) m = '0' + m;
if (seconds.length == 1) s = '0' + s;
var str =h + ':' + m + ':' +s;
//绘制时钟下部的当前时间
Drawtext(str, centerx, centery + radius + 12);
}
function Drawtext(text, x, y)
{
//因为需要使用到坐标平移,所以在平移前线保存当前绘制状态
context.save();
x -= (context.measureText(text).width / 2);//文字起点横坐标
y +=9;//文字起点纵坐标
context.beginPath();//开始创建路径
context.translate(x, y);//平移坐标
context.fillText(text,0,0);//填充文字
context.restore();
}
</script>
<style>
div{
display: -moz-box;
display: -webkit-box;
-moz-box-pack: center;
-webkit-box-pack: center;
width:100%;
}
canvas{
background-color:white;
}
</style>
</head>
<body onload="window_onload()">
<div><h1>使用canvas元素绘制指针式动画时钟</h1></div>
<div><canvas id="canvas" width="200px" height="200px"></canvas><div>//这里就是你的时钟的位置。
</body>
</html>

㈤ 网页时钟代码

<html>
<head>
<script language="vbscript">
dim y,m,d,w,ww
y=Year(Date)
m=Month(Date)
d=Day(Date)
w=WeekDay(Date)
select case w
case 1
ww="星期日"
case 2
ww="星期一"
case 3
ww="星期二"
case 4
ww="星期三"
case 5
ww="星期四"
case 6
ww="星期五"
case 7
ww="<font color=red>星期日</font>"
end select

sub tt()
bb.innerHTML=cstr(time)
call setTimeout("tt()",1000)
end sub
</script>
</head>
<body onLoad="tt()">
<script language="vbscript">
document.write("今天是 "&y&"年"&m&"月"&d&"日 "&ww&"<br>")
</script>
现在的时间是:<span id="bb"></span>
</body>
</html>

㈥ 网页时间代码

<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="22%" class="redfont red"><div align="center">今天是:</div></td>
<td width="78%" class="redfont red"><script language="javascript">
function showTime(){
var oDiv = document.all('oDiv');
var oDate = new Date();
var strTime = oDate.getFullYear() + '年' + eval(oDate.getMonth()+1) + '月' + oDate.getDate() + '日星期' + '日一二三四五六'.substr(oDate.getDay(),1) + '' + oDate.getHours() + ':' + oDate.getMinutes() + ':' + oDate.getSeconds();
oDiv.innerHTML = strTime;
window.setTimeout('showTime()', 1000);
}
window.onload = showTime;
</script>
<div id="oDiv"></div></td>
</tr>
</table>

㈦ 如何在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>

㈧ 修改网页时钟代码

<body onload=s()>
<script>
function s()
{
var x,h,m,s,n;
var x = new Date();
h=x.getHours();
m=x.getMinutes();
s=x.getSeconds();
n=h+":"+m+":"+s;
c.innerHTML=n
setTimeout("s()",1000);
}
</script>
<div id=c></div>
</body>

㈨ 如何在网页加入时钟

你看看我的网页吧,你要是喜欢就把回代码给你呀答

http://xiaonei.com/getuser.do?id=168257957

㈩ 网页制作中如何制作时钟

发2个不用连网的给你
带时钟的台历:

第一步:把如下代码加入<head>区域中:
<STYLE>A.menuitem {
COLOR: menutext; TEXT-DECORATION: none
}
A.menuitem:hover {
COLOR: highlighttext; BACKGROUND-COLOR: highlight
}
DIV.contextmenu {
BORDER-RIGHT: 2px outset; BORDER-TOP: 2px outset; Z-INDEX: 999; VISIBILITY: hidden; BORDER-LEFT: 2px outset; BORDER-BOTTOM: 2px outset; POSITION: absolute; BACKGROUND-COLOR: buttonface
}
</STYLE>
第二步:把如下代码加入<body>区域中:
<STYLE>A.menuitem {
COLOR: menutext; TEXT-DECORATION: none
}
A.menuitem:hover {
COLOR: highlighttext; BACKGROUND-COLOR: highlight
}
DIV.contextmenu {
BORDER-RIGHT: 2px outset; BORDER-TOP: 2px outset; Z-INDEX: 999; VISIBILITY: hidden; BORDER-LEFT: 2px outset; BORDER-BOTTOM: 2px outset; POSITION: absolute; BACKGROUND-COLOR: buttonface
}</P><P></STYLE>
<SCRIPT language=JavaScript>
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="60" height="70" ');
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:9pt;line-height:110%" ');
}
document.write('</td></tr></table>');
document.write('<table border="0" cellpadding="0" cellspacing="0" width="61" bgcolor="#C0C0C0" height="70">');
document.write('<tr><td valign="top" width="100%" height="100%">');
document.write('<table border="1" cellpadding="0" cellspacing="0" width="58" bgcolor="#FEFEEF" height="67">');
document.write('<tr><td align="center" width="100%" height="100%" >');
document.write('<font id="calendarClock1" style="font-family:宋体;font-size:7pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock2" style="color:#ff0000;font-family:Arial;font-size:14pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock3" style="font-family:宋体;font-size:9pt;line-height:120%"> </font><br>');
document.write('<font id="calendarClock4" style="color:#100080;font-family:宋体;font-size:8pt;line-height:120%"><b> </b></font>');
document.write('</td></tr></table>');
document.write('</td></tr></table>');
document.write('</td></tr></table>');
setInterval('refreshCalendarClock()',1000);
</SCRIPT>
倒影时钟:

第一步把下面的代码加入<head> </head>之间
<Script Language="JavaScript">
<!-- Hiding
var ctimer;
function init(){
if (document.all){
tim2.style.left=tim1.style.posLeft;
tim2.style.top=tim1.style.posTop+tim1.offsetHeight-6;
settimes();
}
}

function settimes(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
if (hours<10)
hours="0"+hours;
if(mins<10)
mins="0"+mins;
if (secs<10)
secs="0"+secs;
tim1.innerHTML=hours+":"+mins+":"+secs
tim2.innerHTML=hours+":"+mins+":"+secs
ctimer=setTimeout('settimes()',960);
}
// -->
</Script><style type="text/css">
<!--
.time{
font-family : Comic Sans Ms;
font-size : 14pt;
font-weight : bold;
color: #00008D;
}
-->
</style>

第二步:把以下代码加入<body> 区

<body onLoad="init()" bgcolor="#FFFFFF">

<Div Id="tim1" Style="position: absolute; width: 258; height: 26; top: 30; left: 215" class="time">
</Div>
<Div Id="tim2" Style="position:absolute; filter:flipv() alpha(opacity=20); font-style:italic; left: 695px; top: 50px" class="time">
</Div>