Created
July 6, 2018 06:00
-
-
Save uutarou10/e85094bedb75371aa581e6e0edabfe07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<script> | |
function openWindow() { | |
const win = window.open('./sub.html') | |
// console.log(win.document.body) | |
win.addEventListener('load', () => { | |
const elm = win.document.getElementById('hoge') | |
elm.innerText = 'hello' | |
}) | |
} | |
</script> | |
</head> | |
<body> | |
main window | |
<button onclick="openWindow()">open sub window</button> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
this is sub window | |
<div id="hoge"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DOMContentLoaded
でいけたわ(多分
win.document.addEvent...
だとうまくいかない)