为了账号安全,请及时绑定邮箱和手机立即绑定

为什么不能打开新窗口

<!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>


正在回答

4 回答

window.open([http://www.imooc.com],[_blank],[width:600px;height:400px;top:100px;left:0;]) 

不用【】,用''

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>


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 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>

1 回复 有任何疑惑可以回复我~

<!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>

用引号括起来


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
JavaScript入门篇
  • 参与学习       738108    人
  • 解答问题       9557    个

JavaScript做为一名Web工程师的必备技术,本教程让您快速入门

进入课程

为什么不能打开新窗口

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信