<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>window.open 打开新窗口</title>
<script type="text/javascript">
function Wopen(){
window.open('http://www.imooc.com','_blank','width=1000,height=1000,top=100,left=0,menubar=no,toolbar=no,status=no,scrollbars=no')
}
window.close();
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
</body>
</html>
<script type="text/javascript"> var mywin; function Wopen() { mywin = window.open('http://www.imooc.com', '_blank', 'width=1000,height=1000,top=100,left=0,menubar=no,toolbar=no,status=no,scrollbars=no'); //setTimeout延迟方法执行,延迟5秒 setTimeout("mywin.close()",5000); } </script>
<script type=
"text/javascript"
>
var
mywin;
function
Wopen() {
mywin = window.open(
'http://www.imooc.com'
,
'_blank'
,
'width=1000,height=1000,top=100,left=0,menubar=no,toolbar=no,status=no,scrollbars=no'
);
//setTimeout延迟方法执行,延迟5秒
setTimeout(
mywin.close()
,5000);
}
</script>
<script type="text/javascript"> var mywin; function Wopen() { mywin = window.open('http://www.imooc.com', '_blank', 'width=1000,height=1000,top=100,left=0,menubar=no,toolbar=no,status=no,scrollbars=no'); //setTimeout延迟方法执行,延迟5秒 setTimeout("mywin.close()",5000); } </script>
设置延迟执行的函数:
<script type="text/javascript"> var mywin; function Wopen() { mywin = window.open('http://www.imooc.com', '_blank', 'width=1000,height=1000,top=100,left=0,menubar=no,toolbar=no,status=no,scrollbars=no'); //setTimeout延迟方法执行,延迟5秒 setTimeout("mywin.close()",5000); } </script>