js弹框编程练习

<!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 mywindow = confirm("確定要打開網頁嗎?");//选择框
if(mywindow){
var site = prompt("请输入网址","http://www.imooc.com");//输入框
if(site==""){
alert("網址不能為空!");//警告框
return false
}
window.open(site,'_blank','width=400,height=500,meun=no,toolbar=no');
}else{ 
return false;
} 
}
    
  </script> 
 </head> 
 <body> 
      <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
 </body>
</html>
原文地址:https://www.cnblogs.com/xiaogou/p/5364958.html