Freepages-Help-L Archives

Archiver > Freepages-Help > 2005-06 > 1119927965


From: "Michael Hymer" <>
Subject: More Handy Java
Date: Mon, 27 Jun 2005 23:06:05 -0400


Handy Javascript Snippets
From Bravenet.com
Snippet #1: Add the time to your webpage?

Here's the Code:

<.script type="text/javascript">

var timer = null
function stop()
{
clearTimeout(timer)
}

function start()
{
var time = new Date()
var hours = time.getHours()
var minutes = time.getMinutes()
minutes=((minutes < 10) ? "0" : "") + minutes
var seconds = time.getSeconds()
seconds=((seconds < 10) ? "0" : "") + seconds
var clock = hours + ":" + minutes + ":" + seconds
document.forms[0].display.value = clock
timer = setTimeout("start()",1000)
}

</script>

<body onload="start()" onunload="stop()">

<.form>
<input type="text" name="display" style="background-color: #E8EFFA;
font: bold 11px verdana; width: 63px;"> </form>

Take the contents of the text area and add it to the <head> area of your
webpage. Then replace your <body> with the complete body tag shown, then add
the complete form tag to your page in the location you would like the clock
to appear. It is that simple.

_____

Snippet #2: Last Modified

Do you update your content regularly?
This handy little script can be placed at the bottom of your webpages to
inform your visitors of the last time that page was updated.

This page was last modified:
<.script language="JavaScript">
document.write(document.lastModified);
</script>





This thread: