JQuery打开新窗口

时间:2014-02-27 05:15:53

标签: jquery

我在jsp中嵌入了以下内容。目的是使用指定的选项打开一个新的JSP。但是当页面加载时窗口不会打开。

我做错了吗?

感谢

<body>
    <script type="text/javascript">
        $().ready(function() {
            var siteId = getUrlVars()[PARAMS.GENERAL.SITEID];
            var options = "channelmode=" + 1 +
            ",resizable=" + 1 +
            ",menubar=" + 0 + 
            ",toolbar=" + 0 + 
            ",location=" + 0 + 
            ",titlebar=" + 1 +
            ",status=" + 1 +
            ",scrollbars=" + 1;

            var name = "reporting";
            var appURL = "t.htm?" PARAMS.GENERAL.SITEID + "=" + siteId;
            window.open(appURL,name,options);
        });

    </script>

2 个答案:

答案 0 :(得分:0)

试试这个

window.open(appURL,name,options,target="_blank");

答案 1 :(得分:0)

var appURL = "t.htm?" + PARAMS.GENERAL.SITEID + "=" + siteId;

行上缺少'+'
     <body>
        <script type="text/javascript">
            $().ready(function() {
                var siteId = getUrlVars()[PARAMS.GENERAL.SITEID];
                var options = "channelmode=" + 1 +
                ",resizable=" + 1 +
                ",menubar=" + 0 + 
                ",toolbar=" + 0 + 
                ",location=" + 0 + 
                ",titlebar=" + 1 +
                ",status=" + 1 +
                ",scrollbars=" + 1;

                var name = "reporting";
                var appURL = "t.htm?" + PARAMS.GENERAL.SITEID + "=" + siteId;
                window.open(appURL,name,options);
            });

        </script>