I Download ed the Title Bar script created by Alex Jarvis and it displays the date one month behind. Example it displays FE 28, 2004 instead of the current date MAR 28, 2004. How can this be corrected?This is the wrong forum anyways, but we'll need to see the script.paul is right
the main problem is probably i nthe month display. In languages, these are 0-based, so january is 0. The script probably has January as 1. Therefore, there will be a problem.
Paul, again, is right saying that we must see your code.Here is the code. I did find a solution to my problem. I just went to the line: ("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
and removed the first "", just beofre JAN and it now displays correctly.
Thanks Louis
<!-- THREE STEPS TO INSTALL TITLE BAR CLOCK:
1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! <!-- m --><a class="postlink" href="http://javascript.internet.com">http://javascript.internet.com</a><!-- m --> -->
<!-- Original: Alex Jarvis (<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> ) -->
<!-- Begin
function clock() {
var date = new Date()
var year = date.getYear()
var month = date.getMonth()
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
var months = new Array("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
var monthname = months[month]
if (hour > 12) {
hour = hour - 12
}
if (minute < 10) {
minute = "0" + minute
}
if (second < 10) {
second = "0" + second
}
document.title = "JSS - " + monthname + " " + day + ", " + year + " - " + hour + ":" + minute + ":" + second
setTimeout("clock()", 1000)
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="clock()">
<!-- STEP THREE: Copy this code into the BODY of your HTML document -->
The script is running in the title bar!!
<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href=http://www.webdeveloper.com/forum/archive/index.php/"http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.53 KB -->Get rid of red:var months = new Array("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")Hope this does it!
the main problem is probably i nthe month display. In languages, these are 0-based, so january is 0. The script probably has January as 1. Therefore, there will be a problem.
Paul, again, is right saying that we must see your code.Here is the code. I did find a solution to my problem. I just went to the line: ("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
and removed the first "", just beofre JAN and it now displays correctly.
Thanks Louis
<!-- THREE STEPS TO INSTALL TITLE BAR CLOCK:
1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! <!-- m --><a class="postlink" href="http://javascript.internet.com">http://javascript.internet.com</a><!-- m --> -->
<!-- Original: Alex Jarvis (<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> ) -->
<!-- Begin
function clock() {
var date = new Date()
var year = date.getYear()
var month = date.getMonth()
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
var months = new Array("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
var monthname = months[month]
if (hour > 12) {
hour = hour - 12
}
if (minute < 10) {
minute = "0" + minute
}
if (second < 10) {
second = "0" + second
}
document.title = "JSS - " + monthname + " " + day + ", " + year + " - " + hour + ":" + minute + ":" + second
setTimeout("clock()", 1000)
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="clock()">
<!-- STEP THREE: Copy this code into the BODY of your HTML document -->
The script is running in the title bar!!
<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href=http://www.webdeveloper.com/forum/archive/index.php/"http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.53 KB -->Get rid of red:var months = new Array("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")Hope this does it!