> ...what is wrong with just having:- > var todayEl = document.getElementById("today"); > todayEl.innerHTML = formatDate(new Date);
document.ElementById has a bug in ie6 and ie7 that will return an element with a name attribute of the same value. Use $('#today') instead. todayEl.innerHTML = "something" can cause memory leaks if events are added to DOM objects inside of todayEl and then just written over instead of being removed first. Use $('#today').html(formatDate(new Date)); instead if this could be a cause for concern. On Apr 15, 5:16 pm, kiusau <kiu...@mac.com> wrote: > > If you want to format a local date, . . . > > > > > var todayEl = document.getElementById("today"); > > todayEl.innerHTML = formatDate(new Date); // [1] > > [1]http://www.jibbering.com/faq/#formatDate > > This also worked, but produced a format very different from that > required by the context in which the date must appear. Then too, the > code of the formatDate( ) function requires more knowledge of > JavaScript than I currently possess. This said, there are certainly > other contexts where I can make good use of both the formatDate( ) > function and the innerHTML method. > > In the end, thank you for your input. Even though it did not address > my question directly, it has expanded my knowledge of JavaScript > > Roddy