PDA

View Full Version : Look at this clock script....


DawgieDog
12-26-2002, 07:54 AM
<applet code="Dgclock.class" CODEBASE="http://ba.breederhost.com/java-sys" width="100" height="30">
<param name="TimeFormat" value="">
<param name="ShowDate" value="no">
<param name="ShowFrame" value="yes">
<param name="fg" value="black">
<param name="bg" value="green">
</applet>

If I can change the border color, how can I? Also, if I would want to change the color bg into an image bg what would I have to put in?

Mr J
12-26-2002, 02:05 PM
Because it is an applet chances are you cannot change any parameters unless the author allows it.

On the other hand you could create your own.
To have an image as background change

background-color:#00ff00;

to

background-image:url(pic.jpg);

You can also change border size and colour, text size and color, font size and type etc.



<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Clock1
function showtime1(){
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var timeValue =hours
timeValue += (minutes < 10 ? ":0" : ":") + minutes
timeValue2 = (seconds < 10 ? "0" : "") + seconds

timerID = setTimeout("showtime1()",1000)

clock2.innerHTML =timeValue + "<span style='font-size:12;vertical-align:top'> "+timeValue2+"</span>"
}
setTimeout("showtime1()",1000)
//-->
</SCRIPT>

<P>
<span id="clock2" style="width:80; font-size:20; font-family:arial;color:#000000; background-color:#00ff00; border:4 ridge #80c0ca;text-align;right"></span>
</BODY>
</HTML>

Mhtml
12-26-2002, 05:38 PM
Complete with your background you wanted :)

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Clock1
function showtime1(){
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var timeValue =hours
timeValue += (minutes < 10 ? ":0" : ":") + minutes
timeValue2 = (seconds < 10 ? "0" : "") + seconds

timerID = setTimeout("showtime1()",1000)

clock2.innerHTML =timeValue + "<span style='font-size:12;vertical-align:top'> "+timeValue2+"</span>"
}
setTimeout("showtime1()",1000)
//-->
</SCRIPT>

<table background="http://ba.breederhost.com/bg.gif"><tr>
<td id="clock2" style="color:ffffff;border:4 ridge #80c0ca;text-align;right"></td>
</tr>
</table>
</BODY>
</HTML>

Mr J
12-26-2002, 07:25 PM
Mhtml


I don't exactly get the significant difference?

Other than putting it in a table.

That background is 500 X 535 pixels a bit on the big side for a clock maybe

Mhtml
12-26-2002, 07:30 PM
I was talking with dawgie dog over msn and he is a noob so I simplified it for him because he couldn't get the css..

DawgieDog
12-26-2002, 08:47 PM
Originally posted by Mhtml
Complete with your background you wanted :)

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Clock1
function showtime1(){
var now = new Date()
var hours = now.getHours()
var minutes = now.getMinutes()
var seconds = now.getSeconds()
var timeValue =hours
timeValue += (minutes < 10 ? ":0" : ":") + minutes
timeValue2 = (seconds < 10 ? "0" : "") + seconds

timerID = setTimeout("showtime1()",1000)

clock2.innerHTML =timeValue + "<span style='font-size:12;vertical-align:top'> "+timeValue2+"</span>"
}
setTimeout("showtime1()",1000)
//-->
</SCRIPT>

<table background="http://ba.breederhost.com/bg.gif"><tr>
<td id="clock2" style="color:ffffff;border:4 ridge #80c0ca;text-align;right"></td>
</tr>
</table>
</BODY>
</HTML>



Well, this script is for a 24 hour clock, how can I change it into a 12 hour clock?

DawgieDog
12-27-2002, 04:23 PM
*BUMP* The above question :rolleyes:

cg9com
12-27-2002, 06:05 PM
perhaps you should learn to fish, instead of ask for fish.
beetle posted this in another thread ...
http://www.w3schools.com/js/js_datetime.asp

you do know the pitfalls of a client side clock right?

Mr J
12-27-2002, 08:39 PM
I understand Mhtml ;)

Remember cg9com, we were all newbies at one stage :o



Change line

var timeValue =hours

to

var timeValue = " " + (hours > 12 ? hours - 12 : hours)

cg9com
12-29-2002, 05:25 AM
ima noob 2 :cool:

^KoalaBear^
12-29-2002, 07:45 PM
Hi! Mr J I Was interested in the above clock scripts..

Have you, Mike or anyone else reading this on Codings, seen an analog (I think I'm right) clock face script that shows hour, minute and second hands BUT with a simple text date/time clock associated with it.

To make it a lil clearer to understand what I'd like to achieve is, say 6 analog clocks set for say 6 prime locations around the world... eg. Los Angeles, New York, London, Tokyo, Brussels, Sydney etc but with a line under each showing actual day, date, am-pm time so they can be compared to each other.

I have scripts for the latter set up already, but wish to add a nice analog clock face to each!

Cheers!
KB...
:thumbsup:

Mr J
12-29-2002, 10:50 PM
I did a search for

analogue clock javascript

on the net, there are plenty to choose from

^KoalaBear^
12-29-2002, 11:32 PM
Thank you... I was having a blonde moment!

Hannibal
12-30-2002, 05:49 PM
Originally posted by cg9com
perhaps you should learn to fish, instead of ask for fish.
beetle posted this in another thread ...
http://www.w3schools.com/js/js_datetime.asp

you do know the pitfalls of a client side clock right?

what are the pitfalls of a client side clock cos i have one on my site a picture clock and it works just fine

cg9com
12-30-2002, 06:15 PM
Originally posted by Hannibal
what are the pitfalls of a client side clock cos i have one on my site a picture clock and it works just fine
as it should
the clock will return only the time that is specified on the users system, and for most people it would be correct, but the clock on my box at home was screwy for awhile, and every javascript date/clock script would say something like "January 1 1997"
granted this isnt the biggest problem in the world, its up to you whether you should use it or not.

Hannibal
12-30-2002, 08:16 PM
Originally posted by cg9com
as it should
the clock will return only the time that is specified on the users system, and for most people it would be correct, but the clock on my box at home was screwy for awhile, and every javascript date/clock script would say something like "January 1 1997"
granted this isnt the biggest problem in the world, its up to you whether you should use it or not.

is it possible to make it so that the clock reports the server time/ or a specific timezones time.

cg9com
12-30-2002, 08:30 PM
server time wont be accurate for everyone...
timezones im unsure about ... how would you implement that.