Question:
Can I change the text of my layer through a link? I’ve heard it’s impossible and that I have to change the visibility of the layer and replace it with a new one. Is this true? I’m using Dreamweaver 2 on Windows 98.
Answer:
It’s perfectly possible to change the text of a layer through a link. The trick to it is to write to the element in question using:
document.layer[elementName].document.write(yourText)
It’s an ugly notation, but it works for now. Then close just the element’s body. The following script, for example, will update a counter every time you click on the link:
Untitled I have clicked on thislink0 times.
If you want to add to the layer rather than overwrite it, simply omit the close() statement.