Nick Fitzsimons wrote:
On 1 Mar 2007, at 14:44:59, Bob Schwartz wrote:
var d=new Date();yr=d.getFullYear();if
(yr!=2003)document.write("© "+yr); myplace
which gives me: © 2007 myplace
Here's my pathetic attempt:
window.onload = function() {
var para = document.createElement("p");
var txt1 = document.createTextNode("© ");
var year = new Date().getFullYear();
var now = year;
var txt2 = document.createTextNode()
var txt3 = document.createTextNode(" FIFe");
para.appendChild(txt1);
para.appendChild(txt2);
para.appendChild(txt3);
var testdiv = document.getElementById("testdiv");
testdiv.appendChild(para);
}
Not sure how "FIFe" fits into all this, but...
window.onload = function() {
var year = new Date().getFullYear();
var text = "© " + year + " myplace");
var p = document.createElement("p");
p.appendChild(document.createTextNode(text));
document.getElementById("testdiv").appendChild(p);
}
should do what the original code does. If somebody gets a time machine
up and running and goes back to 2003, well, they'll see the version of
the site from back then anyway, so that's OK :-)
Personally, I don't think that the copyright information should be be
generated client side. But putting that issue aside...
I would shorten it by one line since "year" isn't needed:
var text = "© " + (new Date()).getFullYear() + " myplace");
The parenthesis around "new Date()" aren't needed, but I thinks it makes
it a little clearer. While there are some parts of the order of
presidents that everyone should know, where "new" ranks versus "."
(they're equal) isn't as important.
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************