/    Sign up×
Community /Pin to ProfileBookmark

Clock script

I’ve been trying to get this to work in netscape (version 7+) it works in IE (version 6) perfectly. If anyones got any input it would be appreciated, thank you:
———————–Stright scipt, no extras———-
<html><head>

</head><body bgcolor=”#000000″>
<script language=”JavaScript”>function click() {if ( event.button==2 ) {alert(

‘Denied’ );}}; document.onmousedown=click</script>
<center>
<table border=”0″ cellpadding=”1″ cellspacing=”0″>
<tbody><tr><td valign=”top”></td>
<th>
<form name=”Tick”>
<input type=”hidden” size=”1″ name=”xhour” value=”7″>
<input type=”hidden” size=”1″ name=”xmin” value=”58″>
<input type=”hidden” size=”1″ name=”xsec” value=”36″>
<span id=”QuickClock” onmouseover=”description1()” onmouseout=”description2()”

style=”background: rgb(0, 0, 0) none repeat scroll 0%; -moz-background-clip:

initial; -moz-background-inline-policy: initial; -moz-background-origin:

initial; color: rgb(153, 153, 204); font-weight: bold;”></span>
</form></th>
<td valign=”top”></td>
</tr></tbody></table>
</center>

<script>
<!–
function begin() {
var now = new Date();
document.Tick.xhour.value = now.getHours();
document.Tick.xmin.value = now.getMinutes()-1;
document.Tick.xsec.value = now.getSeconds();

}
function description1() {
window.status=”QST = Quick Standard Time”;
}
function description2() {
window.status=”Welcome”;
}
function show() {
var hours=document.Tick.xhour.value
var minutes=document.Tick.xmin.value
var seconds=document.Tick.xsec.value
var ast=”QST”

seconds++

while ( seconds > 59 ) {
minutes++
seconds=seconds-60
}
while ( minutes > 59 ) {
hours++
minutes=minutes-60
}
if ( hours > 23 )
hours=hours-24

if ( hours==0 )
hours=12

if ( minutes<=9 )
minutes=”0″+minutes

if ( seconds<=9 )
seconds=”0″+seconds

if ( hours%2 == 0 ){
// Noon
ahour=12
asec=( seconds*12 )
amin=( minutes*
12 )
while( asec > 59 ) {
amin++
asec=asec-60
}
while( amin > 59 ) {
ahour++
amin=amin-60
}
if ( amin <10 )
amin=”0″+amin
if ( ahour <10 )
ahour=”0″+ahour

// document.Tick.QuickClock.value=ahour+”:”+amin+” QST”
QuickClock.innerHTML=ahour+”:”+amin+” QST”;

} else {
// Midnight
ahour=0
asec=( seconds*12)
amin=( minutes*
12)
while( asec > 59) {
amin++
asec=asec-60
}
while( amin > 59) {
ahour++
amin=amin-60
}
if ( amin <10)
amin=”0″+amin
if ( ahour <10)
ahour=”0″+ahour

// document.Tick.QuickClock.value=ahour+”:”+amin+” QST”
QuickClock.innerHTML=ahour+”:”+amin+” QST”;
}
if ( amin==00 && ahour==00 )
location=”bell1.html”;

if ( amin==00 && ahour==06 )
location=”bell2.html”;

if ( amin==00 && ahour==12 )
location=”bell3.html”;

if ( amin==00 && ahour==18 )
location=”bell4.html”;

document.Tick.xhour.value=hours
document.Tick.xmin.value=minutes
document.Tick.xsec.value=seconds

setTimeout( “show()”,987 )
}
begin()
show()
//–>
</script>

</body></html>
————————————————–

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@herodote92Aug 22.2005 — Allthough I haven't understood yet which time is this supposed to be, I can suggest the following changes to avoid FireFox warnings:

1/ Add a '&nbsp;' in the span so that it will have a child :

<i>
</i>&lt;span id="QuickClock" onmouseover="description1()" onmouseout="description2()"

style="background: rgb(0, 0, 0) none repeat scroll 0%; -moz-background-clip:

initial; -moz-background-inline-policy: initial; -moz-background-origin:

initial; color: rgb(153, 153, 204); font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;


2/ Refer to its content this way (at 2 different places in the code):

<i>
</i>//QuickClock.innerHTML=ahour+":"+amin+" QST";
document.getElementById('QuickClock').firstChild.data = ahour+":"+amin+" QST";


Otherwise you get a warning every time the content is refreshed.
×

Success!

Help @Makien spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...