PDA

View Full Version : Does this look right



Rou
13-12-2005, 09:16 PM
<applet code="Dgclock.class" CODEBASE="http://habbolt.co.uk/java-sys" width="100" height="30">
<param name="TimeFormat" value="">
<param name="TZ" value="GMT-0000">
<param name="ShowDate" value="yes">
<param name="ShowFrame" value="yes">
<param name="fg" value="red">
<param name="bg" value="black">
</applet>

Java clock , does it look right ?

pechie100
13-12-2005, 09:17 PM
i dnt no i cant do it
nice avatar btw

Dan Williamson
13-12-2005, 09:30 PM
Dunno but this is the place I used to get cool JS codes from when I used to be a newb. Try this one.




HEAD>

<script type="text/javascript">
<!--
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Sandeep Gangadharan :: http://www.sivamdesign.com/home/ */

function sivamtime() {
now=new Date();
hour=now.getHours();
min=now.getMinutes();
sec=now.getSeconds();

if (min<=9) { min="0"+min; }
if (sec<=9) { sec="0"+sec; }
if (hour<10) { hour="0"+hour; }

document.hours.clock.value = hour;
document.minutes.clock.value = min;
document.seconds.clock.value = sec;
setTimeout("sivamtime()", 1000);
}

function sivamtime3() {
now5=new Date();

addH = document.addhours.addclock.value;
addM = document.addminutes.addclock.value;
addS = document.addseconds.addclock.value;

hour3 = parseInt(addH) + now5.getHours();
min3 = parseInt(addM) + now5.getMinutes();
sec3 = parseInt(addS) + now5.getSeconds();

if (sec3>=60) { sec3 = -(60 - sec3); min3 = parseInt(min3)+1; }
if (min3>=60) { min3 = -(60 - min3); hour3 = parseInt(hour3)+1; }
if (hour3>=24) { hour3 = -(24 - hour3); }
if (sec3<=9) { sec3="0"+sec3; }
if (min3<=9) { min3="0"+min3; }
if (hour3<=9) { hour3="0"+hour3; }
if ((addS>59) || (addM>59) || (addH>23)) { window.alert('Invalid Input!!'); return false; }
if ((addS.length > 2) || (addM.length > 2) || (addH.length > 2)) { window.alert('Invalid Input!!'); return false; }
if ((addS.indexOf('-') != -1) || (addM.indexOf('-') != -1) || (addH.indexOf('-') != -1)) { window.alert('Invalid Input!!'); return false; }

document.hours1.clock1.value = hour3;
document.minutes1.clock1.value = min3;
document.seconds1.clock1.value = sec3;
setTimeout("sivamtime3()", 1000);
}
-->
</script>
</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

<BODY onLoad="sivamtime()">

<!-- STEP THREE: Copy this code into the BODY of your HTML document -->

<table border="5" align="center" cellpadding="0" cellspacing="0" width="160" bgcolor="#cccccc">
<tr>
<td>
<table border="0" align="center" cellpadding="0" cellspacing="0" width="80">
<tr>
<td align="center" colspan="3"><br />
<font face="verdana, arial, helvetica, sans-serif" size="1">
Current Time:
</font>
</td>
</tr>
<tr>
<td>
<form name="hours">
<p><input type="text" size="2" name="clock" /></p>
</form>
</td>
<td>
<form name="minutes">
<p><input type="text" size="2" name="clock" /></p>
</form>
</td>
<td>
<form name="seconds">
<p><input type="text" size="2" name="clock" /></p>
</form>
</td>
</tr>
</table><br />

<table border="0" align="center" cellpadding="0" cellspacing="0" width="150">
<tr>
<td align="center">
<font face="verdana, arial, helvetica, sans-serif" size="1">
Add Hours:
</font>
</td>
<td align="center">
<font face="verdana, arial, helvetica, sans-serif" size="1">
Add Minutes:
</font>
</td>
<td align="center">
<font face="verdana, arial, helvetica, sans-serif" size="1">
Add Seconds:
</font>
</td>
</tr>
<tr>
<td align="center">
<form name="addhours">
<input type="text" size="2" value="00" name="addclock" />
</form>
</td>
<td align="center">
<form name="addminutes">
<input type="text" size="2" value="00" name="addclock" />
</form>
</td>
<td align="center">
<form name="addseconds">
<input type="text" size="2" value="00" name="addclock" />
</form>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<form>
<input type="button" value="Get Time" onClick="sivamtime3()" style="font-size: 9pt" />
</form>
</td>
</tr>
</table>

<table border="0" align="center" cellpadding="0" cellspacing="0" width="80">
<tr>
<td align="center" colspan="3">
<font face="verdana, arial, helvetica, sans-serif" size="1">
Scheduled Time:
</font>
</td>
</tr>
<tr>
<td>
<form name="hours1">
<input type="text" size="2" name="clock1" />
</form>
</td>
<td>
<form name="minutes1">
<input type="text" size="2" name="clock1" />
</form>
</td>
<td>
<form name="seconds1">
<input type="text" size="2" name="clock1" />
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 6.07 KB -->

Rou
13-12-2005, 09:31 PM
Thanks Dan.

RLY-CRAIG?
13-12-2005, 09:32 PM
Rep for dan for being helpful;)

.:TeamAmerica:.
13-12-2005, 09:32 PM
Clock looks ok. Maby the seconds and the date could be bigger. And would be great diea to put on full date. But besides that its ace. Did you write that yourself?

Dan Williamson
13-12-2005, 09:36 PM
Cheers.

Used to love the old JavaScript :)

- Dan

Rou
13-12-2005, 09:37 PM
Clock looks ok. Maby the seconds and the date could be bigger. And would be great diea to put on full date. But besides that its ace. Did you write that yourself?

With some help

Want to hide these adverts? Register an account for free!