ITPub博客

首页 > 应用开发 > > confirm 为啥我点了取消还是打开了窗口?

confirm 为啥我点了取消还是打开了窗口?

作者:deepocean601 时间:2019-10-09 16:33:48 0 删除 编辑

<!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 creatNewWindow=confirm("是否需要百度?");

    // 新窗口打开时弹出确认框,是否打开

    if(creatNewWindow=true)

    {

        window.open('https://www.baidu.com/','_blank');

    }

    // 通过输入对话框,确定打开的网址,默认为 http://

    //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。

    else{

        document.write("不跟你玩了!");

        alert("给你一个大嘴巴子!");

    }}

    

  </script> 

 </head> 

 <body> 

 <input type="button" value="百度一下" onClick="openWindow()">

 </body>

 </html>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2557/viewspace-3160903/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: ansible安装及使用
请登录后发表评论 登录
全部评论

注册时间:2019-08-16

  • 博文量
    102
  • 访问量
    475