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>

 

posted @ 2016-04-07 19:06  心雨星空  阅读(138)  评论(0编辑  收藏  举报