Handle HTML DOM load event on iframe using javascript - Javascript DOM

Javascript examples for DOM:Event

Description

Handle HTML DOM load event on iframe using javascript

Demo Code

ResultView the demo in separate window

<html lang="en">
   <head> 
      <title>Modify HTML DOM based on iframe using javascript</title> 
   </head> 
   <body translate="no"> 
      <p id="removeText"> some text</p> 
      <iframe src="https://www.java2s.com" name="iframe_a" id="iframe_a"></iframe> 
      <a href="https://www.java2s.com" target="iframe_a">java2s.com</a> 
      <script>
document.getElementById('iframe_a').onload = function() {
    document.getElementById('removeText').innerHTML = '';
}
    /*  www  .j  av  a  2s  .co  m*/
      </script>  
   </body>
</html>

Related Tutorials