这一段代码为什么不能运行,谢谢大神帮助!

<!DOCTYPE html>
<html>
 <head>
  <title> new document </title> 
  <meta http-equiv="Content-Type" content="text/html; charset=utf8"/>  
  <script type="text/javascript"> 
   
    function openWindow(){
    var poker=confirm("you sure wanna open the website?");
    if(poker=true)
    {dream();}
    else
    {document.write("good boy,you better sheep away!");}
   
    function dream(){
    var heart=prompt("put in the website!");
    if(heart!=null)
    {window.open("heart", "_black", "width=400, height=500, menubar=no, toolbar=no");}
    else
    {window.open("http://www.imooc.com/", "_black", "width=400, height=500, menubar=no, toolbar=no");}
    }


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


Mark_孟8
浏览 1349回答 2
2回答

Caballarii

openWindow缺少右半边大括号if(heart!="")http://www.imooc.com/里的冒号写成了中文的冒号
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript