views:

234

answers:

3

According to a school assignment, only one property of the Document object can be dynamically changed after a Web page is rendered. Is it body or cookie?

+2  A: 

You can manipulate the body contents, but can't assign to the body property. It's a readonly property. You can however set or get the cookies associated with the document. Reference: http://www.w3schools.com/htmldom/dom_obj_document.asp

tvanfosson
+2  A: 

The assignment is wrong: all of the following properties have special meaning in the DOM and are writeable:

  • alinkColor
  • bgColor
  • cookie
  • fgColor
  • linkColor
  • title
  • vlinkColor

The list above should work across different browsers. There are others (like charset and defaultCharset for IE, or some of these for Geckos) which don't, and not all of them are standard.

Christoph
Document Object Properties are as follows: body, cookie, domain, lastModified, referrer, title and url.
Andrew Clark
@Clark: who decided that: `lastModified` is non-standard as well, so why do you exclude other non-standard properties with cross-browser support?
Christoph
@Clark: the `color` properties are even standard, just deprecated
Christoph
A: 

I think your assignment is based on out-of-date technology.

with Javascript, you can do anything after the webpage is rendered. e.g. changing the id name, properties, eventHandler, etc of any DOM dynamically.

Murvinlai