导航:首页 > 网络营销 > 网络时间用的是哪里的表

网络时间用的是哪里的表

发布时间:2023-02-27 03:40:48

如何用JS命令制作一个网络时钟,时间取自网络标准时钟的时间(不是取自本地电脑的时间)。

<div id="d"></div>
<canvas id="clock" width="400" height="400"></canvas>
<script type="text/javascript">
var time = new Date();
var h = time.getHours(); //时
var m = time.getMinutes(); //分
var s = time.getSeconds(); //秒
h=h>12?(h-12)*5+parseInt(m/12):h*5+parseInt(m/12); //时针 初始位置
//=====================================
var x=200,y=200,sAngle=0; //x y 原点 秒针角度变量

function draw(){
var c=document.getElementById("clock");
var ctx=c.getContext("2d"); //获取绘图对象
ctx.clearRect(0,0,c.width,c.height); //清除上次绘制的图形
s++;//秒针

ctx.fillStyle = '#fff' //填充白色背景色
ctx.fillRect(0,0,c.width,c.height); //设置画布区域

//填充圆点,在画布中心(200,200)绘制一个半径10px的圆形
ctx.beginPath();
ctx.arc(x,y,10,0,Math.PI*2,true);
ctx.fill();
ctx.closePath();

//填充版权文字
ctx.fillStyle="#ccc";
ctx.font = "12pt Arial";
ctx.fillText(" beyond",150,250);
//调用日期并填充到画布中
ctx.fillStyle="#666";
ctx.font = "14pt Verdana";
ctx.fillText(time.getMonth()+1+"-"+time.getDate(),183,170);

ctx.save(); //保存当前绘图状态

// 时间刻度
for(var i=0;i<12;i++){
var angle=(Math.PI*2)/12;
ctx.beginPath();//开始绘制
ctx.font="12px Arial";
if(i==0||i==3||i==6||i==9){
ctx.fillStyle="red";
radius=4;
}else{
ctx.fillStyle="blue";
radius=3;
}

ctx.arc(x,y-100,radius,0,Math.PI*2,true); //画圆
ctx.fill(); //填充路径
trans(ctx,x,y,angle); //刻度分布
}
ctx.restore(); //恢复上次保存的绘图状态

sAngle=(Math.PI*2)/60*s; //秒度
//时针转动
ctx.save();
ctx.strokeStyle="red";
ctx.lineWidth=3;
trans(ctx,x,y,(Math.PI*2)/60*h);
pointer(ctx,x,y,y-40);
ctx.restore();

//分针转动
ctx.save();
ctx.strokeStyle="blue";
ctx.lineWidth=2;
trans(ctx,x,y,(Math.PI*2)/60*m);
pointer(ctx,x,y,y-68);
ctx.restore();

//秒针转动
ctx.save();
ctx.strokeStyle="#000";
trans(ctx,x,y,sAngle);
pointer(ctx,x,y,y-80);
ctx.restore();

//数据整理
if(s%60==0){
sAngle=0,s=0,m++;
if(m%12==0){ //每十二分 时针旋转一次
if(m!=0)h++;
if(m%60==0)m=0;
}
if(h%60==0)h=0;
}
}

//绘制指针
function pointer(ctx,x,y,z){
ctx.beginPath();
ctx.moveTo(x,y);
ctx.lineTo(x,z);
ctx.stroke();
ctx.fill();
}

//据坐标旋转
function trans(ctx,x,y,angle){
ctx.transform(Math.cos(angle), Math.sin(angle),
-Math.sin(angle), Math.cos(angle),
x*(1-Math.cos(angle)) + x*Math.sin(angle),
y*(1-Math.cos(angle)) - y*Math.sin(angle))
}

setInterval("draw()",1000);
</script>
</div>

㈡ internet网络高峰时间段是什么时间

CNNIC第17次互联网报告 网民达1.11亿

本次调查结果与上年同期相比,18~22点上网人数增加了8个百分点,上网高峰日趋凸显,20点是当日上网顶峰,61.1%的网民在这一时间上网,21点以后上网人数急剧减少。

根据好耶联合艾瑞市场咨询(iResearch)发布的《2004年好耶网络广告服务报告》的数据显示:2004年中国网民每天上网高峰时间段是19:00-21:00,凌晨到早晨7点间上网的网民比例较低。

这是2004年的,最近的找不到。。。

http://www.hexun.com/Images/08/82/88247.gif

阅读全文

与网络时间用的是哪里的表相关的资料

热点内容
电脑网络重置后一直重启 浏览:478
网络邻居看不到本机电脑 浏览:440
小米手机设置禁止2g网络下载 浏览:867
网络营销渠道应如何进行策划 浏览:256
计算机网络方向和数据库哪个好 浏览:406
监控探头显示检查网络设置 浏览:763
华为超级终端怎么共享网络 浏览:507
会展项目网络营销 浏览:954
计算机网络论文分析 浏览:947
为什么家里的wifi网络这么差 浏览:347
计算机网络品牌 浏览:792
计算机网络架构与设计 浏览:654
座机电脑的网络电缆在哪里 浏览:242
机关网络安全工作责任书 浏览:460
台式连接无线网络连接无法连接 浏览:847
网络咋改密码 浏览:561
怎样连网络手机 浏览:1000
无线网络后台能查看什么资料 浏览:43
信号工网络教育报什么专业 浏览:944
电脑没网络可以拷贝文件 浏览:367

友情链接