•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,662 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,853 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 561 | Replies: 9 | Solved
![]() |
•
•
Join Date: Mar 2008
Posts: 10
Reputation:
Rep Power: 1
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
•
•
Join Date: Feb 2008
Location: Gurgaon India
Posts: 64
Reputation:
Rep Power: 1
Solved Threads: 9
•
•
Join Date: Feb 2008
Location: Gurgaon India
Posts: 64
Reputation:
Rep Power: 1
Solved Threads: 9
•
•
Join Date: Feb 2008
Location: Gurgaon India
Posts: 64
Reputation:
Rep Power: 1
Solved Threads: 9
<!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 5:21 am. Reason: [icode] is for one line of code, [code] is for multiple lines
•
•
Join Date: Feb 2008
Location: Gurgaon India
Posts: 64
Reputation:
Rep Power: 1
Solved Threads: 9
•
•
Join Date: Mar 2008
Posts: 10
Reputation:
Rep Power: 1
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 6:41 am.
•
•
Join Date: Feb 2008
Location: Gurgaon India
Posts: 64
Reputation:
Rep Power: 1
Solved Threads: 9
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- Displaying time on a Form (VB.NET)
- display my computer on the tv question (Windows NT / 2000 / XP / 2003)
- C++ Time Conversion. HEEEEELP plz (C++)
- windows media player cannot display chinese (Windows NT / 2000 / XP / 2003)
- 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


Linear Mode