Forum Moderators: open
A) Create my own date and time without having to get one of those free ones from some site.
B) Have it so my marquee scrolling text can be downloaded as a ticker, I'm sort of aware that the marquee thing may not be the right way to go about things.
Cheers
P84
I'm absolutey struggling with css presentation and use html and some css inline!
Ok, enough for the welcome. Let's see your problems..
A) Don't make a habit of using free stuff and similar scripts. Why? You'll find out that it gets very problematic when you need to do some changes, even small ones.
You can create date and time using php, such as:
// Prints something like: Monday 8th of August 2005 03:12:46 PM
echo date('l jS \of F Y h:i:s A');
Google "php date" and use php.net page for a complete reference on date, time etc..
B) If you actually want a clock that goes "tick-tack" on seconds, then you'll have to use javascript for that, I'll give you the code I use:
1. Put this part where you want the clock to be:
<span id="clock"> </span>
<script type="text/javascript">
window.onload = function(){
updateClock();
setInterval('updateClock()', 1000 );
}
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>
3. You can style the way your clock looks by using css styling (Don't use inline!), set it like this in your head part, just under your title and other meta tags:
<style type="text/css">
<!--
#clock {
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
font-weight: bold;
color: #069;
}
-->
</style>
Try it out and feel free to ask about any of the steps if you need more information.
Good luck and welcome : )
I decided against the scrolling text thing and am looking at rss feeds instead.
As for the clock I will put the code in and try to work out what each part does.
Thanks for welcome and reply, i've been a lurker on here for way too long.
Yours very grateful
P84
I can kind of understand why you'd want it out of the <body>, but why also <html>? Any insight into this would be great.