<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
 <script type="text/javascript">  
    
    // 新窗口打开时弹出确认框,是否打开
     function openWindow()
     {
         var mymessage=confirm("你喜欢javascript么?") ;
         if(mymessage)
         {
           window.open("http://www.imooc.com/","_black","width=400Px,height=500px,menuBar=no,toolBar=no");
         }else{
        var strhttp= prompt("默认打开网址","http://www.imooc.com/")
 document.write(strhttp);
  // 当更改网址后就会出错。
          window.open(strhttp,"_black","width=400Px,height=500px,menuBar=no,toolBar=no")
         }
     }    // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/    //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
    
    
  </script> 
</head><body>
  <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
</body>
</html>