Reply
Time problem
Old 04-25-2007, 01:09 PM Time problem
afridy's Avatar
Extreme Talker

Posts: 184
Hai,

I have put the code to display the date and time in a cell.
i.e. 25th April 2007 08:10:56 like

When the page displays the time is static. i mean the the seconds want change. so how do make it dynamic?

Code:
$date=date("dS F Y h : i : s");
afridy is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-25-2007, 02:04 PM Re: Time problem
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,174
Name: Dan
Location: Swindon
i know this can be done with javascript as i have done it before, i dont think there is a way to make it continusly change as it does it, but javascript definatly can...

I just had a quick search and found a clock script.

http://www.htmlgoodies.com/legacy/be...t/javatime.txt you can see it here...

and the code is
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Clock --
var timerID = null
var timerRunning = false
function stopclock(){
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function startclock(){
stopclock()
showtime()
}
function showtime(){
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var timeValue = "" + ((hours > 12) ? hours - 12 : hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue 
timerID = setTimeout("showtime()",1000)
timerRunning = true
}
//-->
</SCRIPT>
<BODY onLoad="startclock()">
<!-------------------------------------------------------------------------------------------->
<form name="clock" onSubmit="0">
<INPUT TYPE="text" NAME="face" SIZE=11 VALUE ="....Initializing....">
</form>
Im sure you can change its to how you want.


Hope it helps!
TP apprieciated im aiming for 200!
Dan
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 04-25-2007, 02:06 PM Re: Time problem
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,174
Name: Dan
Location: Swindon
also:

i think theres a way (cant remember off top of my head) that you can make the default border on input boxes 0 or the color the same as background so it will blend in as if its normal text and not like its a text box.

Dan
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 04-25-2007, 02:30 PM Re: Time problem
tripy's Avatar
Fetchez la vache!

Posts: 2,057
Name: Thierry
Location: In the void
Quote:
Originally Posted by dansgalaxy View Post
also:

i think theres a way (cant remember off top of my head) that you can make the default border on input boxes 0 or the color the same as background so it will blend in as if its normal text and not like its a text box.

Dan
yep !

in css, specify:
Code:
.date{
  border:0px;
  background-color: transparent;
}
That should do the trick to make the field transparent.
Also, in the input, add the word "disabled", to prevent user to being able to select it.
Code:
<INPUT disabled class="date" TYPE="text" NAME="face" SIZE=11 VALUE ="....Initializing....">
__________________
Listen to the ducky: "This is awesome!!!"

tripy is offline
Reply With Quote
View Public Profile
 
Old 04-25-2007, 02:33 PM Re: Time problem
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,174
Name: Dan
Location: Swindon
dont u have to make it disabled="disabled" to make it all XHTML "complient"

Dan
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 04-25-2007, 07:29 PM Re: Time problem
tripy's Avatar
Fetchez la vache!

Posts: 2,057
Name: Thierry
Location: In the void
Quote:
Originally Posted by dansgalaxy View Post
dont u have to make it disabled="disabled" to make it all XHTML "complient"

Dan
Yep, I think so...
I just didn't used this for so long, I don't really know for sure.
But i it's like a "selected" in a <select>, yep, it's the way to go for Xhtml
__________________
Listen to the ducky: "This is awesome!!!"

tripy is offline
Reply With Quote
View Public Profile
 
Old 04-25-2007, 10:31 PM Re: Time problem
afridy's Avatar
Extreme Talker

Posts: 184
Thank YOu all.
afridy is offline
Reply With Quote
View Public Profile
 
Old 04-26-2007, 05:58 AM Re: Time problem
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
afridy ... can i make a small sugestion .. can you modify the first post title and add [ SOLVED ] to the end ... i think this could help improve this forum a lot if every body did this

Thank you so much
__________________
If you like my posts ... TK is appreciated:)
Web Directory | Blog
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 04-26-2007, 06:29 AM Re: Time problem
BruceWayne's Avatar
Extreme Talker

Posts: 182
Quote:
Originally Posted by dansgalaxy View Post
i know this can be done with javascript as i have done it before, i dont think there is a way to make it continusly change as it does it, but javascript definatly can...

I just had a quick search and found a clock script.

http://www.htmlgoodies.com/legacy/be...t/javatime.txt you can see it here...

and the code is
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Clock --
var timerID = null
var timerRunning = false
function stopclock(){
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function startclock(){
stopclock()
showtime()
}
function showtime(){
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var timeValue = "" + ((hours > 12) ? hours - 12 : hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue 
timerID = setTimeout("showtime()",1000)
timerRunning = true
}
//-->
</SCRIPT>
<BODY onLoad="startclock()">
<!-------------------------------------------------------------------------------------------->
<form name="clock" onSubmit="0">
<INPUT TYPE="text" NAME="face" SIZE=11 VALUE ="....Initializing....">
</form>
Im sure you can change its to how you want.


Hope it helps!
TP apprieciated im aiming for 200!
Dan

This one works! Thanks for sharing this!
BruceWayne is offline
Reply With Quote
View Public Profile Visit BruceWayne's homepage!
 
Old 04-26-2007, 01:22 PM Re: Time problem
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,174
Name: Dan
Location: Swindon
THANKS YAAA 200!! EXACTLY! WOOT WOOT.. i was going to just say look for javscript but i was ina good mood so i found it as well i will probally use it now myself. ...

DAN
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to Time problem
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.17221 seconds with 12 queries