Someone help out a newbie???
Why does this:
date = new Date();
year = date.getFullYear();
document.write(date);
document.write("
");
document.write(year);
work outside of a function, but not inside a function?
The
date = new Date(); works in both cases (I can document.write(date)). Outside of the function, I can document.write(year), but not inside the function.
( full codeCollapse )This is (if it's not obvious) for a digital clock to appear on the page with the client-side time. Ultimately, I want to get it updating "live". I've been told I need to use setTimeout("wc()", 1000) to get it to update every second.