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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


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
Thanks for your registration, follow us on our social networks to keep up-to-date