File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes setting DOM properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "setting DOM properties" Watch "setting DOM properties" New topic

setting DOM properties

Higgledy Smith
Ranch Hand

Joined: Mar 07, 2006
Posts: 192
I am reading JavaScript: A Beginner's Guide, Second Edition and stuck on setting DOM property (page 227)

The author specifically instructs the reader to set the the alinkColor property in a script in the head section of the html document. But this does not work. What does work is setting the alink property in the

Does anyone know why it is not working in the head section? I checked the book's eratta, but no mention this is an error.

Thank you.


Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Because the document doesn't exist yet. Use an onload handler to delay execution until after the DOM exists.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: setting DOM properties
It's not a secret anymore!