[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | Welcome to WEB_AUTHORING |
Notice: | Before writing, please check for an existing topic |
Moderator: | VAXCAT::LAURIE |
|
Created: | Tue Mar 05 1996 |
Last Modified: | Thu Jun 05 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 186 |
Total number of notes: | 1479 |
175.0. "Looping on a document.write command?" by SCAMP::SMITH (Never say never, I always say.) Tue Apr 15 1997 21:43
Is there an easy way (or any way at all) to "loop" on
a document.write command?
I'm displaying a "time-of-day" on a Web Page and would
like it to update each second. All the examples I've
seen have had the clock in a Table, but mine is just
written to the page like text, sort of. As usual, I
can't figure it out. :^(
It can be seen at: http://members.aol.com/mtnbykmike
It's the "red" time near the bottom.
Here's the code if you don't want to go there:
<B><FONT Color="#ffff00">
Your PC thinks today is<br>
<script language="JavaScript">
<!--Hide from wimpy Browsers
var days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday";
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";
var months = new Array(12)
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";
var today = new Date()
var day = days[today.getDay() + 1]
var month = months[today.getMonth() + 1]
var date = today.getDate()
var year = "19" + today.getYear()
document.write(day + ", " + month + " " + date + ", " + year + "\n")
//Stop hiding-->
</script><br>
and the time is
<FONT Color="#ff0000">
<script language="JavaScript">
<!--Hide from wimpy Browsers
var TODAY = new Date()
var HOURS = today.getHours()
var MINUTES = today.getMinutes()
var SECONDS = today.getSeconds()
var CurrentTime = ((HOURS>12) ? (HOURS-12) : HOURS)
CurrentTime += ((MINUTES < 10) ? ":0" : ":") + MINUTES
CurrentTime += ((SECONDS < 10) ? ":0" : ":") + SECONDS
CurrentTime += ((HOURS >= 12) ? "pm" : "am")
document.write(CurrentTime)
//Stop hiding-->
</script></B></font><P><BR>
<FONT Color="#aa00ff">This </font><FONT Color="#00ffff">Web Page</font>
<FONT Color="#aa00ff"> has been accessed <img src="fakecnt1.gif" align="top">
times since yesterday.</font><p>
<A href="index2.htm" onMouseOver="self.status='I hope you enjoy it!';return true">
<img src="grenbutn.jpg" border=0 align="center"></A><p><br>
</center>
</body>
</html>
Thanks!
Mike
T.R | Title | User | Personal Name | Date | Lines
|
---|