window.open接受哪些参数?

时间:2015-08-07 14:07:14

标签: javascript

如何将以下参数添加到window.open()来电?我不确定应该如何命名。

*I don't want a toolbar
*I don't want a menu bar
*I don't want a status bar
*I want a scrollbar
*I don't want the user to be able to resize

以下是我打开窗口的当前代码:

    <head>
    <script type="text/javascript">

    function OLA(url) 
    {
      params  = 'width=290';
      params += ', height='+(parseInt(screen.availHeight) * .9355);
      params += ', top=0, left=0';
      params += ', fullscreen=no';

      newwin=window.open(url,'windowname4', params);
      if (window.focus) {newwin.focus()}
      return false;
    }

    </script>
    </head>

    <body>
    <a href="javascript: void(0)" onclick="OLA('ANO_1_InitialAssessment.html')">Start Here</a>
    </body>

1 个答案:

答案 0 :(得分:1)

对于那些参数,您可以添加到字符串中:

toolbar=off     //I don't want a toolbar
resizable=off   //I don't want the user to be able to resize
menu=off        //I don't want a menu bar
status=off      //I don't want a status bar
scrollbars=on   //I want a scrollbar

我建议查看MDN docs上的window.open页面,它会列出所有参数及其支持。

注意:并非所有参数在所有浏览器上的工作方式都相同