Change variable value in parent - Javascript Data Type

Javascript examples for Data Type:Variable Scope

Description

Change variable value in parent

Demo Code

ResultView the demo in separate window

<!doctype html>
<html>
   <head> 
      <meta http-equiv="X-UA-Compatible" content="IE=Edge"> 
      <title>Child</title> 
   </head> 
   <body> 
      <script>
var p = document.createElement('p');
if (opener) {//from  w w w .jav  a2 s . co  m
    opener.check_var = true;
    p.innerHTML = "Set check_var";
} else {
    p.innerHTML = "No opener";
}
document.body.appendChild(p);

      </script>  
   </body>
</html>

Related Tutorials