> iptYear.setAttribute("onClick","clearField(this);")
Actually that makes sense that it fails. onclick is an event handler,
not an attribute. if you use
iptYear.onclick = function(){clearField(this);}
instead it'll work. If you use onclick in your HTML you mix structure
and behaviour which is not a clever plan in terms of maintenance.
More: http://onlinetools.org/articles/unobtrusivejavascript/chapter4.html
--
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/