|
-
July 13th, 2004, 11:12 AM
#6
Junior Member
hmm i have some way to do that. u can put javascript function in to another file like "script.js". and then u call it from your page like this
<head>
<title></title>
<script language="JavaScript" src="script.js">
</script>
</head>
and example to call that function like this.
<body topmargin="0" leftmargin="0" onLoad="myTime()">
the function myTime() are:
function myTime() {
var today = new Date()
var hours = today.getHours()
var minutes = today.getMinutes()
var seconds = today.getSeconds()
var suffix="AM"
if (hours >= 12) {
suffix="PM"
}
if (hours >= 13) {
hours-=12
} else if (hours == 0) {
hours = 12
}
if (minutes < 10) {
minutes = "0" + minutes
}
if (seconds < 10) {
seconds = "0" + seconds
}
var time = hours + ":" + minutes + ":" + seconds + " " + suffix
parent.header.time.value = time
timer = window.setTimeout("myTime()", 1000)
}
or u can exactly include the script itself to your html
<SCRIPT Language=JavaScript>
<!--
var mon = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var d = new Date();
var date = d.getDate();
var month = d.getMonth();
var year = d.getYear();
if (navigator.appName == 'Netscape') {
year = d.getYear() + 1900;
}
document.write(date + " " + mon[month] + " " + year);
-->
</SCRIPT>
Lord Xavier,
Cyberdelia Technologies,
(Wholly owned by Cyberdelia Group).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|