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

参考代码里的问题,为什么只使用<script>部分不能运行?

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>浏览器对象</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>

正在回答

2 回答

知道了,上面的openWindow写成了openWindow,导致onclick找不到!!!

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

<!DOCTYPE html>
<html>
 <head>
  <title> new document </title>  
  <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>   
  <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="openWindow()" />
 </body>
</html>

这是只使用<script>部分,但是不能运行!为什么?

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

举报

0/150
提交
取消

参考代码里的问题,为什么只使用<script>部分不能运行?

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号