Javascript examples for Data Type:Variable Scope
Change variable value in parent
<!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>