PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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.
Second, JavaScript is only a string to PHP, just as plain text or HTML is. It has no dynamic properties--it is not a language--until it arrives at the browser.
Maybe I can suggest an alternative approach if you explain what you want your users to see and do.
Edit: This post was recovered from search engine cache.
Last edited by McInfo on Thu Jun 17, 2010 3:55 pm, edited 1 time in total.
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.
<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>
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.
JAVA should be JAVASCRIPT
sorry to all i ment to say something like this:
the string captures the updatable clock so that it is updated "i know this can not be outputted" then when i have collected this i want to see:
if the clock is between 11:30 and 12:00 then update a datatabel to be 1 if not then 0
so if the datatabel is 1 it is to update the table called "money" and that would add an adition 30000.
and if datatabel is 0 then dont update...
this is just the very basics of what it is suposed to do but its the basics that is worth working on right now
Well if I was trying to disable a submit button for a time in php it may not be the best way but I would put the submit button html in a php var and only show it when I wanted. for example