Experiment! clock (java)
Posted: Wed Dec 16, 2009 7:40 am
Hi i got a java/php script!
I got this clock that uppdates every second... (java)
then im trying to collect the java class updateClock ( ).
I dont know if this is even possible to do but if it is please direct me to the correect path.
error is as followed:
Fatal error: Class 'java' not found in C:\Program Files\wamp\www\mine\thomas\clock.php on line 63
This would make so that the $clock displays the clock of the instance.
I got this clock that uppdates every second... (java)
then im trying to collect the java class updateClock ( ).
I dont know if this is even possible to do but if it is please direct me to the correect path.
Code: Select all
<html>
<head>
<title>JavaScript Clock</title>
</head>
<script type="text/javascript">
<!--
function init ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("clock").appendChild ( timeDisplay );
}
function updateClock ( )
{
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
// Update the time display
document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}
// -->
</script>
<style type="text/css">
#clock { font-family: Arial, Helvetica, sans-serif; font-size: 0.8em; color: white; background-color: black; border: 2px solid purple; padding: 4px; }
</style>
</head>
<body onload="updateClock(); setInterval('updateClock()', 1000 )">
<div style="clear: both;"> </div>
<h1>The JavaScript clock in action</h1>
<div style="width: 10em; text-align: center; margin: 20px auto;">
<span id="clock">updateClock ( )</span>
</div>
<?php
$clock = new java(updateClock ());
echo $clock;
?>
</body>
</html>
Fatal error: Class 'java' not found in C:\Program Files\wamp\www\mine\thomas\clock.php on line 63
This would make so that the $clock displays the clock of the instance.