慕慕3416675
2018-03-23 21:18
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
var xql=confirm("是否打开窗口");
// 新窗口打开时弹出确认框,是否打开
if(xql==true)
{
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');
}
else
{
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
				第一次是编辑器里边的,第二次是在浏览器上的
				<!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 xql=confirm("是否打开窗口");
        if(xql){
            window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');
        }  
    }
  </script>
 </head> 
 <body> 
 <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
 </body>
</html>
				<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>className属性</title>
    <script type="text/javascript">
       
    // 新窗口打开时弹出确认框,是否打开
    function openWindow(){
        var xql = confirm("是否打开新窗口?");
        if(xql==true){
            window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');
        }
        else{
            alert("打开失败");
        }
    }
    </script>
</head>
<body>
    
    <input name="button" type="button" onClick="openWindow()" value="点击" />
    
</body>
</html>
JavaScript入门篇
741620 学习 · 9869 问题
相似问题