var clockElement = document.getElementById("Clock");
var clockZone = "CMT";
var clockHours = <% DateTime.Now.Hour.ToString(); %>;
var clockMinutes = <% DateTime.Now.Minute.ToString(); %>;
var clockSeconds = <% DateTime.Now.Second.ToString(); %>;
function displayClock(incre) {
var AMorPM;
var hours;
var minutes;
var increment = incre;
if (increment == 1) {
clockSeconds++;
}
if (clockSeconds > 59) {
clockMinutes++;
clockSeconds = 0;
}
if (clockMinutes > 59) {
clockHours++;
clockMinutes = 0;
}
if (clockHours > 23) {
clockHours = 0;
}
if (clockHours < 12) {
AMorPM = "AM";
}
if ((clockHours < 12) && (clockHours > 9)) {
hours = clockHours;
}
if ((clockHours < 10) && (clockHours > 0)) {
hours = "0" + clockHours;
}
if (clockHours == 0) {
hours = 12;
}
if (clockHours > 11) {
AMorPM = "PM";
}
if (clockHours == 12) {
hours = 12;
}
if (clockHours > 12) {
hours = clockHours - 12;
}
clockElement.innerHTML = hours + " : " + minutes + " " + AMorPM + " (" + clockZone + ")";
}
function onloadEvents() {
displayClock(0);
setInterval(displayClock(1), 1000);
}
Here is where the problem is:
var clockHours = <% DateTime.Now.Hour.ToString(); %>;
var clockMinutes = <% DateTime.Now.Minute.ToString(); %>;
var clockSeconds = <% DateTime.Now.Second.ToString(); %>;
Instead of being output like this like it should (the numbers I just typed in to emulate what the codes supposed to do):
var clockHours = 13;;
var clockMinutes = 42;
var clockSeconds = 12;
It gets output into the source code as:
var clockHours = ;
var clockMinutes = ;
var clockSeconds = ;
I really don't understand how its not working because I get no compilation errors or anything so it should display right. Any help on this issue would be greatly appreciated.

New Topic/Question
Reply




MultiQuote




|