猿问

怎么运行不出来?谢谢!

<!DOCTYPE html>

<html>

 <head>

  <title> new document </title>  

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

  <script type="text/javascript">  

    function openWindow(){

    // 新窗口打开时弹出确认框,是否打开

    var bt = confirm("是否打开?");

    if(bt == true){

        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/

        var message = prompt("在文本框中输入要打开的网址:",

        "如http://www.imooc.com");

    }

        if(message!=null){

    //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。     window.open("messgae","_blank","width=400,

    heigh=500,menubar=no,toolbar=no");

        }else{

            alert("再见!");

        }

     else{

         alert("再见!");

     }

    }

  </script> 

 </head> 

 <body> 

 <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 

 </body>

</html>


鄢栋
浏览 1322回答 1
1回答

sevencuijian

<!DOCTYPE html> <html>  <head>   <title> new document </title>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>      <script type="text/javascript">       function openWindow(){         // 新窗口打开时弹出确认框,是否打开         var bt = confirm("是否打开?");         if(bt == true){             // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/             var message = prompt("在文本框中输入要打开的网址:","如http://www.imooc.com");             if(message!=null){                 //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。                      window.open(message,"_blank","width=400,heigh=500,menubar=no,toolbar=no");             }else{                 alert("再见!");             }         }else{              alert("再见!");         }     }   </script>   </head>   <body>   <input type="button" value="新窗口打开网站" onclick="openWindow()" />   </body> </html>我觉得你应该要的是这个效果
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答