87,993
社区成员
发帖
与我相关
我的任务
分享<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
function init() {
document.getElementById('button').addEventListener('click', function () {
var win = window.open('test2.htm', '', 'width=600,height=500');
win.onload = function () {
console.log("into onload function");
var div = win.document.createElement('div')
div.innerHTML = 'Welcome!'
div.style.fontSize = '30px'
win.document.body.insertBefore(div, win.document.body.firstChild)
}
}, false);
}
</script>
</head>
<body onload="init();">
<button id="button">Open window</button>
</body>
</html>