onload事件为什么不能弹出新窗口
function openwin(){
window.open(test.htm', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
}
<body onload="openwin()">
function openwin() { window.open('test.htm', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no') } <body onload="openwin()">这个代码是在页面载入完成后马上打开新窗口,请问你是否正确执行了??
<script> function openwin() { window.open('test.htm', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no') } </script> <body onload="openwin()">必须用脚本标注<script>代码段....</script>并保存为html或htm才可正确执行!