黑客炫酷时钟代码(电脑炫酷时钟代码)
本文目录一览:
要个简单一点的小时钟代码~
这个是文字时钟代码:
script
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours=12)
dn="PM"
if (hours12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes=9)
minutes="0"+minutes
if (seconds=9)
seconds="0"+seconds
//change font size here
var cdate="smallfont color='000000' face='Arial'b"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"/b/font/small"
if (document.all)
document.all.clock.innerHTML=cdate
else
document.write(cdate)
}
if (!document.all)
getthedate()
function goforit(){
if (document.all)
setInterval("getthedate()",1000)
}
/script
body onload="goforit()"
span id="clock"/span
求助,把时钟特效插入下面这串代码中
把下面的这个放在你上面的程序 body时钟代码放这里面/body你还少了一个/html
!-- cool clock --
SCRIPT language=JavaScriptdCol='000099';//date colour.
fCol='668099';//face colour.
sCol='FF0000';//seconds colour.
mCol='000000';//minutes colour.
hCol='000000';//hours colour.
ClockHeight=40;
ClockWidth=40;
ClockFromMouseY=0;
ClockFromMouseX=100;
//Alter nothing below! Alignments will be lost!
d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");
m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");
date=new Date();
day=date.getDate();
year=date.getYear();
if (year 2000) year=year+1900;
TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;
D=TodaysDate.split('');
H='...';
H=H.split('');
M='....';
M=M.split('');
S='.....';
S=S.split('');
Face='1 2 3 4 5 6 7 8 9 10 11 12';
//font='Arial';
font='Verdana';
size=1;
speed=0.6;
ns=(document.layers);
ie=(document.all);
Face=Face.split(' ');
n=Face.length;
a=size*10;
ymouse=0;
xmouse=0;
scrll=0;
props="font face="+font+" size="+size+" color="+fCol+"B";
props2="font face="+font+" size="+size+" color="+dCol+"B";
Split=360/n;
Dsplit=360/D.length;
HandHeight=ClockHeight/4.5
HandWidth=ClockWidth/4.5
HandY=-7;
HandX=-2.5;
scrll=0;
step=0.06;
currStep=0;
y=new Array();x=new Array();Y=new Array();X=new Array();
for (i=0; i n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0}
Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();
for (i=0; i D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0}
if (ns){
for (i=0; i D.length; i++)
document.write('layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'center'+props2+D[i]+'/font/center/layer');
for (i=0; i n; i++)
document.write('layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'center'+props+Face[i]+'/font/center/layer');
for (i=0; i S.length; i++)
document.write('layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15font face=Arial size=3 color='+sCol+'centerb'+S[i]+'/b/center/font/layer');
for (i=0; i M.length; i++)
document.write('layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15font face=Arial size=3 color='+mCol+'centerb'+M[i]+'/b/center/font/layer');
for (i=0; i H.length; i++)
document.write('layer name=nsHours'+i+' top=0 left=0 width=15 height=15font face=Arial size=3 color='+hCol+'centerb'+H[i]+'/b/center/font/layer');
}
if (ie){
document.write('div id="Od" style="position:absolute;top:0px;left:0px"div style="position:relative"');
for (i=0; i D.length; i++)
document.write('div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center"'+props2+D[i]+'/B/font/div');
document.write('/div/div');
document.write('div id="Of" style="position:absolute;top:0px;left:0px"div style="position:relative"');
for (i=0; i n; i++)
document.write('div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center"'+props+Face[i]+'/B/font/div');
document.write('/div/div');
document.write('div id="Oh" style="position:absolute;top:0px;left:0px"div style="position:relative"');
for (i=0; i H.length; i++)
document.write('div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold"'+H[i]+'/div');
document.write('/div/div');
document.write('div id="Om" style="position:absolute;top:0px;left:0px"div style="position:relative"');
for (i=0; i M.length; i++)
document.write('div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold"'+M[i]+'/div');
document.write('/div/div')
document.write('div id="Os" style="position:absolute;top:0px;left:0px"div style="position:relative"');
for (i=0; i S.length; i++)
document.write('div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold"'+S[i]+'/div');
document.write('/div/div')
}
(ns)?window.captureEvents(Event.MOUSEMOVE):0;
function Mouse(evnt){
ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;
}
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
function ClockAndAssign(){
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;
if (ie){
Od.style.top=window.document.body.scrollTop;
Of.style.top=window.document.body.scrollTop;
Oh.style.top=window.document.body.scrollTop;
Om.style.top=window.document.body.scrollTop;
Os.style.top=window.document.body.scrollTop;
}
for (i=0; i n; i++){
var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style;
F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;
F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);
}
for (i=0; i H.length; i++){
var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style;
HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;
HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs);
}
for (i=0; i M.length; i++){
var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style;
ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;
ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min);
}
for (i=0; i S.length; i++){
var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style;
SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;
SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec);
}
for (i=0; i D.length; i++){
var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style;
DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;
DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);
}
currStep-=step;
}
function Delay(){
scrll=(ns)?window.pageYOffset:0;
Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed);
Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed);
for (i=1; i D.length; i++){
Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*speed);
Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*speed);
}
y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);
x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);
for (i=1; i n; i++){
y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed);
x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed);
}
ClockAndAssign();
setTimeout('Delay()',10);
}
if (ns||ie)window.onload=Delay;
/SCRIPT
谁知道一些个性时钟的代码?告诉我几个,拜托!
有一个c 的:
#includemath.h
#includedos.h
#includegraphics.h
#define CENTERX 320 /*表盘中心位置*/
#define CENTERY 175
#define CLICK 100 /*喀嗒声频率*/
#define CLICKDELAY 30 /*喀嗒声延时*/
#define HEBEEP 10000 /*高声频率*/
#define LOWBEEP 500 /*低声频率*/
#define BEEPDELAY 200 /*报时声延时*/
/*表盘刻度形状*/
int Mrk_1[8]={-5,-160,5,-160,5,-130,-5,-130, };
int Mrk_2[8]={-5,-160,5,-160,2,-130,-2-130, };
/*时针形状*/
int HourHand[8]={-3,-100,3,-120,4, 10,-4,10};
/*分针形状*/
int MiHand[8]={-3,-120,3,-120,4, 10,-4,10};
/*秒针形状*/
int SecHand[8]={-2,-150,2,-150,3, 10,-3,10};
/*发出喀嗒声*/
void Click()
{
sound(CLICK);
delay(CLICKDELAY);
nosound();
}
/*高声报时*/
void HighBeep()
{
sound(HEBEEP);
delay(BEEPDELAY);
nosound;
}
/*低声报时*/
void LowBeep()
{
sound(LOWBEEP);
}
/*按任意角度画多边形*/
void DrawPoly(int *data,int angle,int color)
{
int usedata[8];
float sinang,cosang;
int i;
sinang=sin((float)angle/180*3.14);
cosang=cos((float)angle/180*3.14);
for(i=0;i8;i+=2)
{
usedata[i] =CENTERX+ cosang*data[i]-sinang*data[i+1]+.5;
usedata[i+1]=CENTERY+sinang*data[i]+cosang*data[i+1]+.5;
}
setfillstyle(SOLID_FILL,color);
fillpoly(4,usedata);
}
/*画表盘*/
void DrawClock(struct time *cutime)
{
int ang;
float hourrate,minrate,secrate;
setbkcolor(BLUE);
cleardevice();
setcolor(WHITE);
/* 画刻度*/
for(ang=0;ang360;ang+=90)
{
DrawPoly(Mrk_1,ang,WHITE);
DrawPoly(Mrk_2,ang+30,WHITE);
DrawPoly(Mrk_2,ang+60,WHITE);
}
secrate=(float)cutime-ti_sec/60;
minrate=((float)cutime-ti_min+secrate)/60;
hourrate=(((float)cutime-ti_hour/12)+minrate)/12;
ang=hourrate*360;
DrawPoly(HourHand,ang,YELLOW);/*画时针*/
ang=minrate*360;
DrawPoly(MiHand,ang, GREEN);/*画分针*/
ang=secrate*360;
DrawPoly(SecHand,ang, RED);/*画秒针*/
}
main()
{
int gdriver=EGA,
gmode=EGAHI;
int curpage;
struct time curtime ,newtime ;
initgraph(gdriver,gmode,"c:\\tc");
setbkcolor(BLUE);
cleardevice();
gettime(curtime);
curpage=0;
DrawClock(curtime);
while(1)
{
if(kbhit())
break; /*按任意键退出*/
gettime(newtime); /*检测系统时间*/
if(newtime.ti_sec!=curtime.ti_sec)/*每1秒更新一次时间*/
{
if(curpage==0)
curpage=1;
else
curpage=0;
curtime=newtime;
/*设置绘图页*/
setactivepage(curpage);
/*在图页上画表盘*/
DrawClock(curtime);
/*设置绘图页为当前可见页*/
setvisualpage(curpage);
/*0分0秒高声报时*/
if(newtime.ti_min==0newtime.ti_sec==0)
HighBeep();
/* 59分55至秒时低声报时*/
else if(newtime.ti_min==59
newtime.ti_sec=59)
LowBeep();/*其他时间只发出喀嗒声*/
else
Click();
}
}
closegraph();
}
时钟代码
回答:lillianrock
新手
6月21日 14:57 地址 ttp://
代码 BREMBED src="时钟地址" type="application/x-shockwave- fash" width="180" height="180"/EMBEDBR
把以上一个地址复制--粘贴到地址栏中,然后按回车观看效果,看完一个,改变"clock1"中的数字,140个时钟,找到自己喜欢的了,把地址覆盖粘贴在上面代码中"时钟地址"上,然后把整理好的代码粘贴在一个新建立的模块中就好了!
欢迎来我的博客
用c++编写一个时钟的代码
这里是148款精美时钟代码
flash时钟,时钟,qq空间时钟代码,透明flash时钟
以下是flash时钟代码:(博客flash时钟库)
object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" width="300" height="200"
param name="movie" value="flash时钟地址"
param name="quality" value="high"
embed src="d" quality="high" pluginspage="" type="application/x-shockwave-flash"/embed
/object
说明:(手动插入必看)
1、width=300,height=300为flash文件的宽度和高度,你可以自定修改
2、flash时钟地址,是flash文件地址,复制以下任一地址都行,如:/free/UploadFiles_2504/clock/clock1.swf
flash时钟下载, 下载方法:(请用“右键-目标另存为”方式下载,或是使用下载工具)
下面为您提供一些时钟地址,效果见FLASH栏目里的“时钟样式”专辑,也可以直接点击下面的网址查看效果。您可以对照选择您喜欢的样式。
时钟1:/free/UploadFiles_2504/clock/clock1.swf
时钟2:/free/UploadFiles_2504/clock/clock2.swf
时钟3:/free/UploadFiles_2504/clock/clock3.swf
时钟4:/free/UploadFiles_2504/clock/clock4.swf
时钟5:/free/UploadFiles_2504/clock/clock5.swf
时钟6:/free/UploadFiles_2504/clock/clock6.swf
时钟7:/free/UploadFiles_2504/clock/clock7.swf
时钟8:/free/UploadFiles_2504/clock/clock8.swf
时钟9:/free/UploadFiles_2504/clock/clock9.swf
时钟10:/free/UploadFiles_2504/clock/clock10.swf
时钟11:/free/UploadFiles_2504/clock/clock11.swf
时钟12:/free/UploadFiles_2504/clock/clock12.swf
时钟13:/free/UploadFiles_2504/clock/clock13.swf
时钟14:/free/UploadFiles_2504/clock/clock14.swf
时钟15:/free/UploadFiles_2504/clock/clock15.swf
时钟16:/free/UploadFiles_2504/clock/clock16.swf
时钟17:/free/UploadFiles_2504/clock/clock17.swf
时钟18:/free/UploadFiles_2504/clock/clock18.swf
时钟19:/free/UploadFiles_2504/clock/clock19.swf
时钟20:/free/UploadFiles_2504/clock/clock20.swf
时钟21:/free/UploadFiles_2504/clock/clock21.swf
时钟22:/free/UploadFiles_2504/clock/clock22.swf
时钟23:/free/UploadFiles_2504/clock/clock23.swf
时钟24:/free/UploadFiles_2504/clock/clock24.swf
时钟25:/free/UploadFiles_2504/clock/clock25.swf
时钟26:/free/UploadFiles_2504/clock/clock26.swf
时钟27:/free/UploadFiles_2504/clock/clock27.swf
时钟28:/free/UploadFiles_2504/clock/clock28.swf
时钟29:/free/UploadFiles_2504/clock/clock29.swf
时钟30:/free/UploadFiles_2504/clock/clock30.swf
时钟31:/free/UploadFiles_2504/clock/clock31.swf
时钟32:/free/UploadFiles_2504/clock/clock32.swf
时钟33:/free/UploadFiles_2504/clock/clock33.swf
时钟34:/free/UploadFiles_2504/clock/clock34.swf
时钟35:/free/UploadFiles_2504/clock/clock35.swf
时钟36:/free/UploadFiles_2504/clock/clock36.swf
时钟37:/free/UploadFiles_2504/clock/clock37.swf
时钟38:/free/UploadFiles_2504/clock/clock38.swf
时钟39:/free/UploadFiles_2504/clock/clock39.swf
时钟40:/free/UploadFiles_2504/clock/clock40.swf