Home Javascript JavaScript applyElement method Example
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

JavaScript applyElement method Example

Advertisement
The user can apply some properties to the element of the HTML document by using the method applyElement(), which is called on some object of element.

JavaScript applyElement method Example

     

The user can apply some properties to the element of the HTML document by using the method applyElement(), which is called on some object of element. Here in this example we have applied element links properties to the "Div Content"  by removing link from the link.

Example how to use applyElement:

 Object.applyElement( elementProperty);

Description of example:

In the following example code we have created a link in HTML by using the tag <a></a> and one div by using the <div></div> tag and to apply the element's property we have created a button. As soon as user clicks on the button it will call the JavaScript function ApplyElement() defined in the <script> </script> tag.

applyElementExample.html

<html>
  <head>
    <title>applyElement Example</title>
     <script>
	function ApplyElement(){
	 document.getElementById('divId')
         .applyElement(document.links[0]);
	}
     </script>
  </head>
    <body>
      <a href="#">Link</a> 
 	<div id="divId">Div Content</div>
	<button onclick="ApplyElement(); this.disabled=true;">
          Apply The Link To The Div
        </button>
  </body>
</html>

 

Output:

When you will click on the button it will apply link to the div.

Download Source Code

     

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 29, 2009

Ask Questions?    Discuss: JavaScript applyElement method Example  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com