| Lösung 21
|
|
|
<head>
<script language="JavaScript">
<!--
function init() {
var ii;
for(ii=1; ii<10; ii++) {
img=new Image();
img.src="rc_"+ii+".gif";
}
setTimeout("clock()", "1000");
}
function clock() {
var ii;
var date=new Date();
var hh=date.getHours();
ii=Math.floor(hh/10);
document.h1.src="rc_"+ii+".gif"
ii=hh%10;
document.h2.src="rc_"+ii+".gif"
var mm=date.getMinutes();
ii=Math.floor(mm/10);
document.m1.src="rc_"+ii+".gif"
ii=mm%10;
document.m2.src="rc_"+ii+".gif"
var ss=date.getSeconds();
ii=Math.floor(ss/10);
document.s1.src="rc_"+ii+".gif"
ii=ss%10;
document.s2.src="rc_"+ii+".gif"
setTimeout("clock()", "1000");
}
//-->
</script>
</head>
<body onLoad="init();">
<img src=rc_0.gif width=15 height=20 name="h1">
<img src=rc_0.gif width=15 height=20 name="h2">
<img src=rc_x.gif width=15 height=20>
<img src=rc_0.gif width=15 height=20 name="m1">
<img src=rc_0.gif width=15 height=20 name="m2">
<img src=rc_x.gif width=15 height=20>
<img src=rc_0.gif width=15 height=20 name="s1">
<img src=rc_0.gif width=15 height=20 name="s2">
</body>
Ein ähnliches Beispiel ist der Countdown bis zum Jahr 2000.