Window.Open 方法不执行

SambaGao 2014-08-09 05:23:25
我想在一个页面加载完后执行Window.Open.

因此代码是
$(document).ready(function(){
Window.open("www.baidu.com");
});

不过Window.location.href可以执行。但是我想要弹出一个窗口.

试了各种方法。Window.open就是不执行.
...全文
600 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
SambaGao 2014-08-09
  • 打赏
  • 举报
回复
Hi jikeytang, 我刚测试了一下,还是不行。我的浏览器是Chrome. 感谢大家的回复.
xuzuning 2014-08-09
  • 打赏
  • 举报
回复
1、确认你已加载了 jQuery 2、window.open("http://www.baidu.com"); 3、检查你的浏览器是否设置了拦截弹出式窗口
豪情 2014-08-09
  • 打赏
  • 举报
回复
不是不执行,是被拦截掉了。 试试这个:

<!doctype html>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script>
</head>
<body>
<script type="text/javascript">
    $(function(){
        window.showModalDialog('http://www.baidu.com')
    });
</script>
</body>
</html>
uczone 2014-08-09
  • 打赏
  • 举报
回复
//简单弹窗类
function openChildFrame(strUrl, strTitle, strWidth, strHeight, isScrollbar) {
    var iheight = strHeight;
    var iwidth = strWidth;
    var ileft = (screen.width - iwidth) / 2;
    var itop = (screen.height - iheight) / 2;
    var iscrollbar = isScrollbar;
    if (iscrollbar == null || iscrollbar == "") iscrollbar = "no";
    var feature = "left=" + ileft + ",top=" + itop + ",fullscreen=0,width=" + iwidth + ",height=" + iheight + ",toolbar=no,menubar=no,scrollbars=" + iscrollbar;
    feature += ",resizable=no,location=no,status=yes,dialog=yes";
    var strWindow = window.open(strUrl, strTitle, feature);
    return strWindow;
}

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧