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.


 

Ads

Tutorials   
Ads

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

     

Advertisements

Ads
Share on Google+Share on Google+

JavaScript applyElement method Example

Posted on: January 29, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: JavaScript applyElement method Example  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads