2016/1/17时钟

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>时钟</title>
<!--另外一个时钟-->
<script language="JavaScript">
var H = ‘.....‘;
var H = H.split("");
var M = "....";
var M = M.split("");
var S = "....";
var S = S.split("");
var Ypos = 0;
var Xpos = 0;
var Ybase = 8;
var Xbase = 8;
var dots = 12;
function clock1(){
var time = new Date();
var secs = time.getSeconds();
var seco = 1.57 + Math.PI*secs/30;
var mins = time.getMinutes();
var min = 1.57 + Math.PI*mins/30;
var hrs = time.getHours();
var hr = 1.57 + Math.PI*hrs/6 + Math.PI*parseInt(time.getMinutes())/360;
for(var i = 0;i < dots;++i){
document.getElementById("dig" + (i+1)).style.top = 0-15 + 40 * Math.sin(-0.49 + dots + i/1.9).toString() + "px";
document.getElementById("dig" + (i+1)).style.left = 0-14 + 40 * Math.cos(-0.49 + dots+ i/1.9).toString() + "px";
}
for(var i = 0;i< S.length;++i){
document.getElementById("sec" + ( i + 1)).style.top = Ypos + i * Ybase + Math.sin(secs).toString() + "px";
document.getElementById("sec" + ( i + 1)).style.left = Xpos + i* Xbase; + Math.cos(secs).toString() + "px"
}
for(var i = 0;i < M.length;i++){
document.getElementById("min" + (i + 1)).style.top = Ypos + i * Ybase + Math.sin(min).toString() + "px";
document.getElementById("min" + (i + 1)).style.left = Xpos + i * Xbase + Math.cos(min).toString() + "px";
}
for(i = 0;i < H.length;i++){
document.getElementById("hour" + (i + 1)).style.top = Ypos + Ybase * i + Math.sin(hrs).toString() + "px";
document.getElementById("hour" + (i + 1)).style.top = Ypos + Ybase * i + Math.sin(hrs).toString() + "px";
}
setTimeout(‘clock1()‘,50);
}
</script>
<style>
div.dig,div.hour,div.min,div.sec{
position: absolute;
}
div.hour,div.min,div.sec{
width: 2px;
height: 2px;
font-size: 2px;
}
div.dig{
width : 30px;
height: 10px;
font-size: 10px;
color: #00000;
text-align: center;
padding-top: 10px;
font-family: "黑体";
}
div.min{
background-color: #0000FF;
}
div.hour{
background-color: #00000;
}
div.sec{
background-color: #FF000;
}
</style>
</head>
<body >
<div class="example">
<table>
<tr>
<td>
<div style="width: 120px;height:100px;position: relative;left: 58px;text-outline:50px;">
<div id = "dig1" class="dig">1</div>
<div id = "dig2" class="dig">2</div>
<div id = "dig3" class="dig">3</div>
<div id = "dig4" class="dig">4</div>
<div id = "dig5" class="dig">5</div>
<div id = "dig6" class="dig">6</div>
<div id = "dig7" class="dig">7</div>
<div id = "dig8" class="dig">8</div>
<div id = "dig9" class="dig">9</div>
<div id = "dig10" class="dig">10</div>
<div id = "dig11" class="dig">11</div>
<div id = "dig12" class="dig">12</div>
<div id = "hour1" name = "hour"></div>
<div id = "hour2" name = "hour"></div>
<div id = "hour3" name = "hour"></div>
<div id = "hour4" name = "hour"></div>
<div id = "min1" class = "min"></div>
<div id = "min2" class = "min"></div>
<div id = "min3" class = "min"></div>
<div id = "min4" class = "min"></div>
<div id = "min5" class = "min"></div>
<div id = "sec1" class="sec"></div>
<div id = "sec2" class="sec"></div>
<div id = "sec3" class="sec"></div>
<div id = "sec4" class="sec"></div>
<div id = "sec5" class="sec"></div>
<div id = "sec6" class="sec"></div>
</div>
</td>
</tr>
</table>
</div>
<!--<canvas id = "clock" style="background-color: black" width="500px" height="500px">-->
<!--你的浏览器不支持canvas-->
<!--</canvas>-->
<!--<script type="text/javascript">-->
<!--var canvas = document.getElementById("clock");-->
<!--var cxt = canvas.getContext("2d");-->
<!--function drawClock(){-->
<!--var now = new Date();-->
<!--var sec = now.getSeconds();-->
<!--var mint = now.getMinutes();-->
<!--var hour = now.getHours();-->
<!--hour>12?hour-12:hour;-->
<!--hour+=(mint/60);-->
<!--//清空画布-->
<!--cxt.clearRect(0,0,canvas.width,canvas.height);-->
<!--//选择图片作为背景-->
<!--var img = new Image();-->
<!--img.src = "1.jpeg";-->
<!--cxt.drawImage(img,46,46);-->
<!--//画表盘大圆-->
<!--cxt.strokeStyle = "#00FFFF";-->
<!--cxt.lineWidth = 10;-->
<!--cxt.beginPath();-->
<!--cxt.arc(250,250,200,0,360);-->
<!--cxt.stroke();-->
<!--cxt.closePath();-->
<!--//时刻度-->
<!--for(var i;i<12;i++){-->
<!--//保持原样-->
<!--cxt.save();-->
<!--cxt.lineWidth = 7;-->
<!--cxt.strokeStyle = "#FFFF00";-->
<!--//设置原点-->
<!--cxt.translate(250,250);-->
<!--//设置旋转角度-->
<!--cxt.rotate(30*Math.PI*i/180);-->
<!--cxt.beginPath();-->
<!--cxt.moveTo(0,-175);-->
<!--cxt.lineTo(0,-195);-->
<!--cxt.stroke();-->
<!--cxt.closePath();-->
<!--cxt.restore();-->
<!--}-->
<!--//分刻度-->
<!--for(var i = 0;i < 60;i++){-->
<!--cxt.save();-->
<!--cxt.lineWidth = 5;-->
<!--cxt.strokeStyle = "#FFFF00";-->
<!--cxt.translate(250,250);-->
<!--cxt.rotate(i*6*Math.PI/180);-->
<!--cxt.beginPath();-->
<!--cxt.moveTo(0,-185);-->
<!--cxt.lineTo(0,-195);-->
<!--cxt.closePath();-->
<!--cxt.restore();-->
<!--}-->
<!--//时针的角度-->
<!--cxt.save();-->
<!--cxt.lineWidth = 7;-->
<!--cxt.strokeStyle = "#00FFFF";-->
<!--cxt.translate(250,250);-->
<!--cxt.rotate(hour*30*Math.PI/180);-->
<!--cxt.beginPath();-->
<!--cxt.moveTo(0,-130);-->
<!--cxt.lineTo(0,10);-->
<!--cxt.stroke();-->
<!--cxt.closePath();-->
<!--cxt.restore();-->
<!--//分针的角度-->
<!--cxt.save();-->
<!--cxt.lineWidth = 5;-->
<!--cxt.strokeStyle = "#FFFF00";-->
<!--cxt.translate(250,250);-->
<!--cxt.rotate(Math.PI*mint*6/180);-->
<!--cxt.beginPath();-->
<!--cxt.lineTo(0,-150);-->
<!--cxt.moveTo(0,10);-->
<!--cxt.stroke();-->
<!--cxt.closePath();-->
<!--cxt.restore();-->
<!--//秒针的角度-->
<!--cxt.save();-->
<!--cxt.lineWidth = 3;-->
<!--cxt.strokeStyle = "#FF0000";-->
<!--cxt.translate(250,250);-->
<!--cxt.rotate(sec*6*Math.PI/180);-->
<!--cxt.beginPath();-->
<!--cxt.lineTo(-0,170);-->
<!--cxt.moveTo(0,10);-->
<!--cxt.stroke();-->
<!--cxt.closePath();-->
<!--cxt.restore();-->
<!--//中间的小圆-->
<!--cxt.beginPath();-->
<!--cxt.arc(0,0,7,0,360);-->
<!--cxt.fillStyle = "#FFFF00";-->
<!--cxt.fill();-->
<!--cxt.strokeStyle = "#FF0000";-->
<!--cxt.stroke();-->
<!--cxt.closePath();-->
<!--//秒针上的小圆-->
<!--cxt.beginPath();-->
<!--cxt.arc(0,-140,7,0,360);-->
<!--cxt.fillStyle = "#FFFF00";-->
<!--cxt.fill();-->
<!--cxt.stroke();-->
<!--cxt.closePath();-->
<!--cxt.restore();-->
<!--//显示时间-->
<!--cxt.font = "18px 微软雅黑";-->
<!--cxt.lineWidth = 2;-->
<!--cxt.fillStyle = "#FFFF00";-->
<!--hour = now.getHours();-->
<!--var str = hour>10?hour:("0"+hour)+":"+(mint>10?mint:("0"+mint));-->
<!--cxt.fillText(str,225,380);-->
<!--cxt.font = "12px 宋体";-->
<!--cxt.lineWidth = 1;-->
<!--cxt.fillText("Made in china",210,400);-->
<!--}-->
<!--drawClock();-->
<!--setInterval(drawClock(),1000);-->
<!--</script>-->
</body>
</html>

时间: 2024-08-11 18:14:54

2016/1/17时钟的相关文章

2016/5/17学习记录

1出现void is an invalid type for the variable的情况的解决方案. void is an invalid type for the variable d的意思是: 变量d不支持void类型 第一步:检查拼写是否错误;  第二步:检查函数的位置,尤其是存在嵌套关系的函数. 今天我联系继承的时候把定义函数的部分写在了main函数里,跳出了这样的问题,后来经过排查发现输错了位置. 2今天的代码,主要是学习了继承,简单的例子,用到了ArrayList容器的方法. p

2016/1/18 更正补充 2016/1/17 矩形面积 1,构造方法初始化 长和宽 ,2, 定义成员方法求矩形面积

1 package caipiao; 2 3 import java.util.*; //引入java工具.util是utiliy的缩写,意为多用途的, 4 // 工具性质的包 这个包中主要存放了:集合类(如ArrayList,HashMap等), 5 //随机数产生类,属性文件读取类,定时器类等类. 6 public class JuXing1 {//这些类极大方便了Java编程,日常java编程中,经常要用到这些类. 7 //属性 8 private double chang; //私有化

ACM-南京理工大学第八届程序设计竞赛-网络赛(2016.04.17)

A.偷吃糖果Time Limit: 1000Ms Memory Limit: 65536KB Description小鱼喜欢吃糖果.他有两盒糖果,两盒糖果分别仅由小写字母组成的字符串s和字符串t构成.其中'a'到'z'表示具体的某种糖果类别.他原本打算送给他喜欢的女生,但是要送给女孩子的话两盒糖果不能有差别(即字符串s和t完全相同).所以,他决定偷吃几块,他吃糖果的策略是每次选出一盒糖果中两个连续的同种类别的糖果,然后吃掉其中一块.该策略可以使用多次.例如一盒糖果是'rrrjj',他可以把这盒糖

2016.6.17——Valid Parentheses

Valid Parentheses 本题收获: 1.stack的使用 2.string和char的区别 题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}&qu

2016.6.17——Remove Duplicates from Sorted Array

Remove Duplicates from Sorted Array 本题收获: 1.“删除”数组中元素 2.数组输出 题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this i

2016/1/17 矩形面积 1,构造方法初始化 长和宽 ,2, 定义成员方法求矩形面积

1 public class Square { 2 int chang; 3 int kuan; 4 int mianji; 5 String colour; 6 //构造方法一 有参数 7 Square(int c,int k){ 8 chang=c; 9 kuan=k; 10 } 11 Square(String se){ 12 colour=se; 13 } 14 //构造方法二 无参数 默认是无的 15 Square(){ 16 17 } 18 19 //一 无返回值 无参数 20 /*

2016/05/17 thinkphp3.2.2 分页的使用:①在Home下设置Publics文件夹或在thinkPHP下library的vender 把page.class.php 考贝进入 ②通过new 实例化方式调用 $page=new \Home\Publics\Page($total,3);

注意分页的方法有两种:一种是thinkphp3.2 自带的   另一种是之前新闻页用过的     显示效果稍有差别 显示效果: 细节问题: ①搜索页面  要加session判断   和  分页 ②修改和添加页面需要有session判断 ③增删改的权限设置 控制器端: 1 <?php 2 namespace Home\Controller; 3 use Think\Controller; 4 class UserController extends Controller 5 { 6 public

分布式技术一周技术动态 2016.01.17

分布式系统实践 1. Apache HBase 2015年发展回顾与未来展望 https://mp.weixin.qq.com/s?__biz=MzAwMDU1MTE1OQ==&mid=403219545&idx=1&sn=119613ae7d52de9c033b3ed0598bae6a&scene=0&key=41ecb04b05111003bd0affa70f2b91e7b66a30a4d6c249144a35c4803953e9154f772362b0679f

2016/05/17 thinkphp3.2.2 ① Ajax 使用 ②前端验证

显示效果: ①Ajax使用:   注意传值的所有过程用的是小写,及时数据库列的名称中有大写字母 控制器部分: AjaxController.class.php 1 <?php 2 namespace Home\Controller; 3 use Think\Controller; 4 class AjaxController extends Controller 5 { 6 7 public function Ajax(){ 8 9 if (empty($_POST)) { 10 $this->