星空网 > 软件开发 > Java

谷歌不兼容showModalDialog()方法出现对话窗口解决方法

      javascript中showModalDialog()方法在IE,火狐,百度,360等浏览器可以使用,但是在谷歌浏览器下去没有任何反应,现在我给大家一种方法,当然这个方法是我在网上找的,调试可以使用。

<script type="text/javascript">    //开启模式窗口    function showMyModal() {      var url = "SelectUser.aspx";      //传入参数示例      var modalReturnValue = myShowModalDialog(url, window, 300, 500);      //alert(modalReturnValue.name);      //窗口关闭后执行某些方法      //TODO sth    }    //弹出框google Chrome执行的是open    function myShowModalDialog(url, args, width, height) {      var tempReturnValue;      if (navigator.userAgent.indexOf("Chrome") > 0) {        var paramsChrome = 'height=' + height + ', width=' + width + ', top=' + (((window.screen.height - height) / 2) - 50) +          ',left=' + ((window.screen.width - width) / 2) + ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';        window.open(url, "newwindow", paramsChrome);      }      else {        var params = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;status:no;dialogLeft:'              + ((window.screen.width - width) / 2) + 'px;dialogTop:' + (((window.screen.height - height) / 2) - 50) + 'px;';        tempReturnValue = window.showModalDialog(url, args, params);      }      return tempReturnValue;    }  </script>

最后想要点击就可以出现对话框就行,只需要使用onclick事件进行调用方法就行




原标题:谷歌不兼容showModalDialog()方法出现对话窗口解决方法

关键词:谷歌

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

Primaseller:https://www.goluckyvip.com/tag/24142.html
Prime Air:https://www.goluckyvip.com/tag/24143.html
Prime Airfreight:https://www.goluckyvip.com/tag/24144.html
Prime Day Exclusive:https://www.goluckyvip.com/tag/24145.html
Prime Day Inc:https://www.goluckyvip.com/tag/24146.html
Prime Now:https://www.goluckyvip.com/tag/24147.html
NRA账户的开户主体包括:香港、美国、新加坡、欧盟等国家的详细解析 :https://www.xlkjsw.com/news/94338.html
湘西游轮六 湘江游轮夜游:https://www.vstour.cn/a/411226.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流