I'll post a java one for you ..
If you want javascript, go to Baidu and search for it yourself. There are many.
Import java.awt.color;
Import java.util. *;
Import java.awt. *;
Import java.applet. *;
Implementation of Runnable by Common Class Clock Extension Applet
{
Thread timer = null
Label;;
int lastxs=50,lastys=30,lastxm=50,lastym=30,lastxh=50,lastyh = 30
Public void init ()
{
Label = new label ("");
set background(color . white);
To add (a label);
}
Public blank paint (figure g)
{
int xh,yh,xm,ym,xs,ys,s,m,h,xcenter,ycenter
Date right now = new Date();
string today = right now . tolocalestring();
Label.setText (today);
s = right now . get seconds();
m = right now . get minutes();
h = right now . get hours();
xcenter = 100;
ycenter = 80
xs =(int)(math . cos(s * 3. 14f/30-3. 14f/2)* 45+xcenter);
ys =(int)(math . sin(s * 3. 14f/30-3. 14f/2)* 45+y center);
XM =(int)(math . cos(m * 3. 14f/30-3. 14f/2)* 45+xcenter);
ym =(int)(math . sin(m * 3. 14f/30-3. 14f/2)* 45+y center);
xh =(int)(math . cos((h * 30+m * 2)* 3. 14f/ 180-3. 14f/2)* 30+xcenter);
yh =(int)(math . sin((h * 30+m * 2)* 3. 14f/ 180-3. 14f/2)* 30+y center);
G.setFont (new font ("TimesToman", font. Plain,14));
g . set color(color . orange);
g.fill3DRect(xcenter-50,ycenter-50, 100, 100,true);
g . set color(color . dark gray);
G. pull the rope ("12", xcenter-5, ycenter-37);
g.drawString("3 ",xcenter+40,y center+3);
G. pull the rope ("6", xcenter-3, ycenter+45);
G. pull the rope ("9", xcenter-45, y center+3);
g . set color(color . orange);
If (xs! =lastxs||ys! =lastys)
{
g.drawLine(xcenter,ycenter,lastxs,lastys);
}
If (xm! =lastxm||ym! =lastym)
{
g.drawLine(xcenter,ycenter- 1,lastxm,lastym);
g.drawLine(xcenter- 1,ycenter,lastxm,lastym);
}
if(xh! =lastxh||yh! =lastyh)
{
g.drawLine(xcenter,ycenter- 1,lastxh,last yh);
g.drawLine(xcenter- 1,ycenter,lastxh,last yh);
}
g . set color(color . red);
g.drawLine(xcenter,ycenter,xs,ys);
g.drawLine(xcenter,ycenter- 1,xm,ym);
g.drawLine(xcenter- 1,ycenter,xm,ym);
g.drawLine(xcenter,ycenter- 1,xh,yh);
g.drawLine(xcenter- 1,ycenter,xh,yh);
lastxs = xs
lastys = ys
lastxm = xm
lastym = ym
lastxh = xh
lastyh = yh
}
Public void start ()
{
if(timer==null)
{
Timer = new thread (this);
timer . start();
}
}
Public invalid site ()
{
timer = null
}
Public invalid operation ()
{
While (timer! = empty)
{
attempt
{
thread . sleep( 1000);
} catch(interrupted exception ie){ }
repaint();
}
timer = null
}
Public void update (graph g)
{
Paint (gram);
}
}