Closed Thread Icon

Topic awaiting preservation: display in netscape Pages that link to <a href="https://ozoneasylum.com/backlink?for=8974" title="Pages that link to Topic awaiting preservation: display in netscape" rel="nofollow" >Topic awaiting preservation: display in netscape\

 
Author Thread
slim___shady
Nervous Wreck (II) Inmate

From: canada
Insane since: Aug 2002

posted posted 12-22-2003 00:37

This code renders a clock in IE fine but not in Netscape. Someone please edit this code so that the clock appears in Netscape as well.

Thanx

<html><head><title>clock</title>

<script language="javascript">
function clock() {
if (!document.layers && !document.all) return;
var digital = new Date();
var hours = digital.getHours();
var minutes = digital.getMinutes();
var seconds = digital.getSeconds();
var amOrPm = "AM";
if (hours > 11) amOrPm = "PM";
if (hours > 12) hours = hours - 12;
if (hours == 0) hours = 12;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
if (document.layers) {
document.layers.one.document.write(dispTime);
document.layers.one.document.close();
}else
if (document.all)
one.innerHTML = dispTime;
setTimeout("clock()", 1000);
}
</script></head>

<body onload="clock()">

<div width="100%" style="text-align:center">
<span id="one" style="text-align:center;font:bold 8pt verdana"></span>
</div>

</body></html>

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 12-22-2003 04:22

Are you talking about netscape navigator 4.x or the new Netscape based off of Mozilla?

In the former case, I'm sure not doing it (and I would advise against spending any time doing so). In the latter case, it needs to be pointed out that your code contains extremely outdated techniques (such as the usage of document.layers and document.all). You should look into the document.getElementById() function for starters.

smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 12-22-2003 17:26

Can I also make a suggestion - just a bit of forum etiquette I learned many threads ago:

DO NOT PLACE ORDERS, it might just be the way you have written it, but "Someone please edit this code so that the clock appears in Netscape as well." sounds a little demanding, it would have been better if you had described your problems better and then asked for people to help. Remember, people at this forum DO have better things to do than help you. Always put your thread in the form of a question, that requires the use of '?'

But I have no huge qualms with your post, I'm too busy to help out at the moment anyway, but Listen to Slime. Also ask yourself if you really need a DHTML clock, afterall nearly everybody looking at your site will be using some form of electronic device that has it's own clock already. Besides, if you really need a clock ask Google < http://www.google.com/search?q=javascript+clock > it knows everything

Good luck buddy, and have a cool Christmas,

Jon

<A HREF="http://www.cryokinesis.co.uk" TARGET=_blank>visit

Yossi Admon
Bipolar (III) Inmate

From: Israel
Insane since: Nov 2001

posted posted 12-22-2003 20:08

<html><head><title>clock</title>

<script language="javascript">
function clock() {
var digital = new Date();
var hours = digital.getHours();
var minutes = digital.getMinutes();
var seconds = digital.getSeconds();
var amOrPm = "AM";
if (hours > 11) amOrPm = "PM";
if (hours > 12) hours = hours - 12;
if (hours == 0) hours = 12;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
var obj = (document.all)?one:document.getElementById("one");
if(obj){
// Support IE5.0+ and NS6+
obj.innerHTML = dispTime;
} else if(document.layers) {
// NS4.7
var lyr = document.one.document;
lyr.write(dispTime)
lyr.close()
} else return;
setTimeout("clock()", 1000);
}
</script></head>

<body onload="clock()">

<div width="100%" style="text-align:center">
<span id="one" style="text-align:center;font:bold 8pt verdana"></span>
</div>

</body></html>


Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 12-23-2003 14:22

<html><head><title>clock</title>

<div style="font-weight: bold">Look at your watch.</div>

</body></html>


Archonian
Nervous Wreck (II) Inmate

From: Sweden, Malmoe
Insane since: Jan 2003

posted posted 12-26-2003 16:40

=)

« BackwardsOnwards »

Show Forum Drop Down Menu