| | |
display time
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 17
Reputation:
Solved Threads: 0
If i have, for example, a marquee that displays time when i push a button,like this:
,it will display the time at the moment that i pushed the button. How could i make it to display the time continously?
Cheers
php Syntax (Toggle Plain Text)
if($_POST['time']) echo "<marquee direction=right behavior=alternate scrolldelay=500 scrollamount=30>".date('d-m-Y').' GMT'.date('P').' '.date('H:i:s')."</marquee>";
,it will display the time at the moment that i pushed the button. How could i make it to display the time continously?
Cheers
PHP Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>t</title> </head> <body> <marquee direction=right behavior=alternate scrolldelay=500 scrollamount=30><div id="a"></div></marquee> </body> </html> <script type="text/javascript"> function show() { var Digital=new Date() var hours=Digital.getHours() var minutes=Digital.getMinutes() var seconds=Digital.getSeconds() var dn="AM" if (hours>12) { dn="PM" hours=hours-12 } if (hours==0) hours=12 if (minutes<=9) minutes="0"+minutes if (seconds<=9) seconds="0"+seconds document.getElementById('a').innerHTML= ""+hours+":"+minutes+":"+seconds+" "+dn +"" setTimeout("show()",1000) } show() </script>
Last edited by peter_budo; Mar 30th, 2008 at 6:21 am. Reason: [icode] is for one line of code, [code] is for multiple lines
•
•
Join Date: Mar 2008
Posts: 17
Reputation:
Solved Threads: 0
thank you,that works
i wrote a similar code (i think) and included the condition that the clock should appear when pushing a button...but when i push the button nothing happens...any ideas?
EDIT: without the marquee tags, the script works
i wrote a similar code (i think) and included the condition that the clock should appear when pushing a button...but when i push the button nothing happens...any ideas?
php Syntax (Toggle Plain Text)
<html> <head> <script type="text/javascript"> function startTime() { var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); // add a zero in front of numbers<10 m=checkTime(m); s=checkTime(s); document.getElementById('txt').innerHTML=h+":"+m+":"+s; t=setTimeout('startTime()',500); } function checkTime(i) { if (i<10) { i="0" + i; } return i; } </script> </head> <body onload="startTime()"> <form method=post action=d.php> <input type=submit value="Push for time!" name=time />     <input type=submit value="Push to stop time!" name=stoptime /> </form> <?php if(isset($_POST['time'])) if($_POST['time']) echo "<marquee direction=right behavior=alternate scrolldelay=500 scrollamount=30><div id='txt'></div></marquee>"; ?> </body> </html>
EDIT: without the marquee tags, the script works
Last edited by soultrav; Mar 29th, 2008 at 7:41 am.
![]() |
Similar Threads
- Displaying time on a Form (VB.NET)
- display my computer on the tv question (Windows NT / 2000 / XP)
- C++ Time Conversion. HEEEEELP plz (C++)
- windows media player cannot display chinese (Windows NT / 2000 / XP)
- Getting the time from GetSystemTime (C)
- Time Refreshing on a GUI Menu Bar (Java)
- !NEW!:::::!!Time Display Program!! (C++)
- Time display program (C++)
- IE causing problem with Win Explorer Display (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: Session management
- Next Thread: Need improved email script
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





