Skip to content

Commit fa5eff9

Browse files
committed
Merge pull request iliakan#199 from zhibirc/patch-1
Set body to newWin.document.body
2 parents 962b221 + eeaf250 commit fa5eff9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

7-frames-and-windows/1-window-methods/article.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,14 @@ alert(newWin.location.href); // (*) about:blank, загрузка ещё не н
122122
newWin.onload = function() {
123123

124124
// создать div в документе нового окна
125-
var div = *!*newWin*/!*.document.createElement('div');
125+
var div = *!*newWin*/!*.document.createElement('div'),
126+
body = newWin.document.body;
127+
126128
div.innerHTML = 'Добро пожаловать!'
127129
div.style.fontSize = '30px'
128130

129131
// вставить первым элементом в body нового окна
130-
body.insertBefore(div, newWin.document.body.firstChild);
132+
body.insertBefore(div, body.firstChild);
131133
}
132134
```
133135

0 commit comments

Comments
 (0)