qq_自律_0
2016-04-28 21:18
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>window.open</title>
<script type="text/javascript">
function Wopen(){
window.open([http://www.imooc.com],[_blank],[width:600px;height:400px;top:100px;left:0;])
}
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
</body>
</html>
window.open([http://www.imooc.com],[_blank],[width:600px;height:400px;top:100px;left:0;])
不用【】,用''
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>window.open</title>
<script type="text/javascript">
function Wopen(){
window.open('http://www.imooc.com','_blank','width:600px,height:400px,top:100px,left:0;')
} ;
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>window.open</title>
<script type="text/javascript">
function openWindon(){
if(confirm("确定打开新窗口吗?")){
var url = prompt("请输入一个网址","http://www.imooc.com/");
window.open( url,"_blank","toolbar=no, menubar=no, scrollbars=yes, width=400, height=400");
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindon()" />
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>window.open</title>
<script type="text/javascript">
function Wopen(){
window.open("http://www.imooc.com","_blank","width:600px;height:400px;top:100px;left:0;")
}
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
</body>
</html>
用引号括起来
JavaScript入门篇
739816 学习 · 9566 问题
相似问题