---以下をコピーして使います---
<HTML>
<HEAD>
<TITLE>DHTML SAMPLES</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=shift_jis">
<SCRIPT LANGUAGE="JavaScript1.2">
function setClock() {
var today = new Date()
var HOUR = today.getHours()
if(HOUR > 12) {
HOUR = HOUR - 12
}
var MINUTE = today.getMinutes()
var SECOND = today.getSeconds()
if(SECOND == 0) {
setTimeout("setClock()",1000)
} else {
secondHand.Rotate(0,0,SECOND*6)
longHand.Rotate(0,0,MINUTE*60/10)
shortHand.Rotate(0,0,(HOUR*60*60+MINUTE*60)/120)
clockHeart()
}
}
//var baseSecond
function clockHeart() {
tmpToday = new Date()
var baseSecond = tmpToday.getSeconds()
secondHand.SetIdentity()
secondHand.Rotate(0,0,baseSecond*6)
if(baseSecond == 0) {
var baseMinute = tmpToday.getMinutes()
longHand.SetIdentity()
longHand.Rotate(0,0,baseMinute*60/10)
var baseHour = tmpToday.getHours()
if(baseHour > 12) {
baseHour = baseHour - 12
}
shortHand.SetIdentity()
shortHand.Rotate(0,0,(baseHour*60*60+baseMinute*60)/120)
}
setTimeout("clockHeart()",1000)
}
function divSet(){
secondHand.style.setExpression("left","document.body.clientWidth/2 - secondHand.offsetWidth/2");
secondHand.style.setExpression("top","document.body.clientHeight/2 - secondHand.offsetHeight/2");
shortHand.style.setExpression("left","document.body.clientWidth/2 - secondHand.offsetWidth/2");
shortHand.style.setExpression("top","document.body.clientHeight/2 - secondHand.offsetHeight/2");
longHand.style.setExpression("left","document.body.clientWidth/2 - secondHand.offsetWidth/2");
longHand.style.setExpression("top","document.body.clientHeight/2 - secondHand.offsetHeight/2");
num0.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*-3)*100 - num0.offsetWidth/2")
num0.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*-3)*100 - num0.offsetHeight/2")
num1.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*-2)*100 - num1.offsetWidth/2")
num1.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*-2)*100 - num1.offsetHeight/2")
num2.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*-1)*100 - num2.offsetWidth/2")
num2.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*-1)*100 - num2.offsetHeight/2")
num3.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*0)*100 - num3.offsetWidth/2")
num3.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*0)*100 - num3.offsetHeight/2")
num4.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*1)*100 - num4.offsetWidth/2")
num4.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*1)*100 - num4.offsetHeight/2")
num5.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*2)*100 - num5.offsetWidth/2")
num5.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*2)*100 - num5.offsetHeight/2")
num6.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*3)*100 - num6.offsetWidth/2")
num6.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*3)*100 - num6.offsetHeight/2")
num7.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*4)*100 - num7.offsetWidth/2")
num7.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*4)*100 - num7.offsetHeight/2")
num8.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*5)*100 - num8.offsetWidth/2")
num8.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*5)*100 - num8.offsetHeight/2")
num9.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*6)*100 - num9.offsetWidth/2")
num9.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*6)*100 - num9.offsetHeight/2")
num10.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*7)*100 - num10.offsetWidth/2")
num10.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*7)*100 - num10.offsetHeight/2")
num11.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*8)*100 - num11.offsetWidth/2")
num11.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*8)*100 - num11.offsetHeight/2")
clockCircle.style.setExpression("left","document.body.clientWidth/2 - clockCircle.offsetWidth/2")
clockCircle.style.setExpression("top","document.body.clientHeight/2 - clockCircle.offsetHeight/2")
}
</SCRIPT>
<STYLE TYPE="text/css">
.number { position:absolute;width:30;height:30;
font-size:30;font-family:Arial;
text-align:center;color:white;
filter:shadow(color="black",direction=135);
}
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
}
</STYLE>
</HEAD>
<BODY onload="divSet();setClock();">
<DIV ID="clockCircle" class="clockArea">
</DIV>
<!--以下、1-12の数値-->
<DIV ID="num0" CLASS="number">12</DIV>
<DIV ID="num1" CLASS="number">1</DIV>
<DIV ID="num2" CLASS="number">2</DIV>
<DIV ID="num3" CLASS="number">3</DIV>
<DIV ID="num4" CLASS="number">4</DIV>
<DIV ID="num5" CLASS="number">5</DIV>
<DIV ID="num6" CLASS="number">6</DIV>
<DIV ID="num7" CLASS="number">7</DIV>
<DIV ID="num8" CLASS="number">8</DIV>
<DIV ID="num9" CLASS="number">9</DIV>
<DIV ID="num10" CLASS="number">10</DIV>
<DIV ID="num11" CLASS="number">11</DIV>
<!-- 秒針 -->
<OBJECT ID="secondHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6"
STYLE="position:absolute;width:200;height:200;">
<PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)">
<PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)">
<PARAM NAME="Line0003" VALUE="PolyLine(2, 0,0, 0,-100)">
</OBJECT>
<!-- 長針 -->
<OBJECT ID="longHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6"
STYLE="position:absolute;width:200;height:200;">
<PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)">
<PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)">
<PARAM NAME="Line0003" VALUE="PolyLine(6, 0,0, -3,0, -3,-90, 3,-90, 3,0, 0,0)">
</OBJECT>
<!-- 短針 -->
<OBJECT ID="shortHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6"
STYLE="position:absolute;width:200;height:200;">
<PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)">
<PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)">
<PARAM NAME="Line0003" VALUE="PolyLine(6, 0,0, -3,0, -3,-70, 3,-70, 3,0, 0,0)">
</OBJECT>
</BODY>
</HTML>
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
}
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
}
background-image:url(back.jpg);
.clockArea { position:absolute;width:240;height:240;
background-image:url(back.jpg);
}
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
}
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
border:2 solid red;
}
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
border:15 outset navy;
}
.number { position:absolute;width:30;height:30;
font-size:30;font-family:Arial;
text-align:center;color:white;
filter:shadow(color="black",direction=135);
}
.number { position:absolute;width:30;height:30;
font-size:35;font-family:Arial Black;
text-align:center;color:gold;
filter:shadow(color="black",direction=135);
}
font-style:italic;
filter:shadow(color="black",direction=135);
<DIV ID="num0" CLASS="number">12</DIV>
<DIV ID="num0" CLASS="number" STYLE="color:red;">12</DIV>
<DIV ID="num0" CLASS="number"><FONT COLOR="red">12</FONT></DIV>
<DIV ID="num0" CLASS="number" STYLE="background-color:red;">12</DIV>
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
}
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
filter:alpha(opacity=30);
}
.clockArea { position:absolute;width:240;height:240;
background-color:red;
filter:alpha(opacity=0,finishopacity=100,style=1,startX=0,startY=0,finishX=100,finishY=100);
}
<!-- 秒針 --> <OBJECT ID="secondHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6" STYLE="position:absolute;width:200;height:200;"> <PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)"> <PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)"> <PARAM NAME="Line0003" VALUE="PolyLine(2, 0,0, 0,-100)"> </OBJECT> <!-- 長針 --> <OBJECT ID="longHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6" STYLE="position:absolute;width:200;height:200;"> <PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)"> <PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)"> <PARAM NAME="Line0003" VALUE="PolyLine(6, 0,0, -3,0, -3,-90, 3,-90, 3,0, 0,0)"> </OBJECT> <!-- 短針 --> <OBJECT ID="shortHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6" STYLE="position:absolute;width:200;height:200;"> <PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)"> <PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)"> <PARAM NAME="Line0003" VALUE="PolyLine(6, 0,0, -3,0, -3,-70, 3,-70, 3,0, 0,0)"> </OBJECT>
<PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)">
<PARAM NAME="Line0001" VALUE="SetLineColor(255,0,0)">
<PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)">
<PARAM NAME="Line0003" VALUE="PolyLine(6, 0,0, -3,0, -3,-70, 3,-70, 3,0, 0,0)">
<PARAM NAME="Line0003" VALUE="PolyLine(5, 0,0, -5,-50, 0,-80, 5,-50, 0,0)">
<OBJECT ID="longHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6" STYLE="position:absolute;width:200;height:200;"> <PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)"> <PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)"> <PARAM NAME="Line0003" VALUE="PolyLine(6, 0,0, -3,0, -3,-90, 3,-90, 3,0, 0,0)"> </OBJECT>
<OBJECT ID="longHand" CLASSID="clsid:369303C2-D7AC-11d0-89D5-00A0C90833E6" STYLE="position:absolute;width:200;height:200;"> <PARAM NAME="Line0001" VALUE="SetLineColor(0,0,0)"> <PARAM NAME="Line0002" VALUE="SetLineStyle(1,1)"> <PARAM NAME="Line0003" VALUE="SetFillColor(0,255,255)"> <PARAM NAME="Line0004" VALUE="Polygon(6, 0,0, -3,0, -3,-90, 3,-90, 3,0, 0,0)"> </OBJECT>
<PARAM NAME="Line0003" VALUE="PolyLine(6, 0,0, -3,0, -3,-90, 3,-90, 3,0, 0,0)">
<PARAM NAME="Line0003" VALUE="SetFillColor(0,255,255)"> <PARAM NAME="Line0004" VALUE="Polygon(6, 0,0, -3,0, -3,-90, 3,-90, 3,0, 0,0)">
.clockArea { position:absolute;width:240;height:240;
background-color:pink;
}
.clockArea { position:absolute;width:100;height:100;
background-color:pink;
}
num1.style.setExpression("left","document.body.clientWidth/2 + Math.cos(Math.PI*2/12*-2)*100 - num1.offsetWidth/2")
num1.style.setExpression("top","document.body.clientHeight/2 + Math.sin(Math.PI*2/12*-2)*100 - num1.offsetHeight/2")
.number { position:absolute;width:30;height:30;
font-size:30;font-family:Arial;
text-align:center;color:white;
filter:shadow(color="black",direction=135);
}
.number { position:absolute;width:20;height:20;
font-size:17;font-family:Arial;
text-align:center;color:white;
filter:shadow(color="black",direction=135);
}