问答详情
源自:8-1 window对象

运行没结果,怎么回事?

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>window对象</title>

<script type="text/javascript">

    function myfun{

        alert("点击我,弹出新窗口!");

        window.open("http://www.imooc.com","_break","width=600,height=400 ");

    

    }


</script>

</head>

<body>

<form>

<input type="button" value="点击我,打开新窗口" onclick="myfun()" />

</form>

</body>

</html>


提问者:古月风苑 2017-05-01 15:54

个回答

  • panrad
    2017-08-13 18:40:43

    <script type="text/javascript">

        function myfun(){

        alert("点击我,弹出新窗口!");

        window.open("http://www.imooc.com","_blank","width=600px,height=400px ");

     }

    </script>

    </head>

    <body>

    <form>

    <input type="button" value="点击我,打开新窗口" onclick="myfun()" />

    你的程序当中第七行  myfun()缺少括号,第九行是“_blank”,并不是break.另外width和height属性,最好加上px.


  • CopyLeft
    2017-05-01 16:43:49

    定义函数的时候忘记写"()"了,应该是"function myfun(){"