Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: DHTML
Expertise: Beginner
Feb 3, 1999

Changing a Layer Through a Link

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 this
link 

0

      times.


    
    


If you want to add to the layer rather than overwrite it, simply omit the close() statement.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap