<html>
<head>
<title>JavaScript Unleashed</title>
<script type="text/javascript">
<!--
function Clock (hours, minutes){
this.hours = hours;
this.minutes = minutes;
this.setTime = setTime;
this.displayTime = displayTime;
}
function setTime (hours, minutes){
this.hours = hours;
this.minutes = minutes;
}
function displayTime (){
var line = this.hours + ":" + this.minutes;
document.write ("<hr>Time of clock: " + line);
}
//-->
</script>
</head>
<body>
<script type="text/javascript">
<!--
var currTime = new Date();
var myClock = new Clock(currTime.getHours (), currTime.getMinutes ());
myClock.displayTime (); //-->
</script>
</body>
</html>
|