Call getElementById from another page - Javascript DOM

Javascript examples for DOM:Document getElementById

Description

Call getElementById from another page

Demo Code

ResultView the demo in separate window

<html>
   <head>
      <script type="text/javascript">
  function callPage1()//from w w w  .jav  a  2  s  . c  o  m
   { 
     window.parent.document.getElementById('fromPage2').innerHTML='Hello from page 2';
     window.parent.page2Function();
     
   };
 
      </script> 
   </head>
   <body> 
      <div id="page2Elem">
         Page 2 Element
      </div> 
      <input type="button" value="Call Page 1" onclick="callPage1();">  
   </body>
</html>

Related Tutorials