Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/451.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何打开弹出窗口,使其';s的高度是从屏幕顶部到底部?_Javascript_Html_Css - Fatal编程技术网

Javascript 如何打开弹出窗口,使其';s的高度是从屏幕顶部到底部?

Javascript 如何打开弹出窗口,使其';s的高度是从屏幕顶部到底部?,javascript,html,css,Javascript,Html,Css,我试图打开一个弹出窗口,使其高度从屏幕顶部到窗口的“应用程序”栏。代码如下: function windowOpener(windowHeight, windowWidth, windowName, windowUri) { var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeig

我试图打开一个弹出窗口,使其高度从屏幕顶部到窗口的“应用程序”栏。代码如下:

function windowOpener(windowHeight, windowWidth, windowName, windowUri) {

var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;


var centerWidth = (window.screen.width - windowWidth) / 2;
var centerHeight = (window.screen.height - windowHeight) / 2;


newWindow = window.open(windowUri, windowName, 'resizable=0,scrollbars=1,width=' + windowWidth +
    ',height=' + windowHeight +
    ',left=' + centerWidth);

newWindow.focus();
return newWindow.name;

}
为什么它在IE中不起作用?(镀铬)


谢谢

我想你只需要screen.width和screen.height。不要在它们前面加窗户

编辑:显然IE需要“全屏=是”参数

试试这个:

<script type="text/javascript">
<!--
function popup(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}
// -->
</script>

<a href="javascript: void(0)" 
   onclick="popup('popup.html')">Fullscreen popup window</a>

如果您只想全屏打开新窗口,是否尝试删除高度和宽度参数

newWindow = window.open(windowUri, windowName);
这对我来说很有用:

<a class="popme" href="http://codesheet.org">popup</a>

演示:

这确实会使弹出窗口变大!但是你知道如何让它停在“应用程序”栏上,在那里你可以看到你在Windows中打开的所有应用程序吗?我尝试将scrollbars=1添加到参数中,但它似乎不起作用:params+=',resizable=0,scrollbars=1';你有解决方案吗?
var popup=window.open(this.href+''player','height='+wh+',width='+w+',scrollbars=no,left='+left+',top='+top)应该是
var popup=window.open(this.href+''player',height='+h+',width='+w+',scrollbars=no,left='+left+',top='+top)
  $(document).ready(function() {
    $(".popme").click(function(event){
      var h = 650;
      var w = 340;
      var wh = screen.height;
      var ww = screen.width;
      var top = wh/2 - h/2;
      var left = ww/2 - w/2;
      var popup = window.open(this.href + '', 'player', 'height=' + wh + ', width=' + w + ', scrollbars=no, left=' + left + ', top=' + top);
      popup.focus();
      return false;
    });
  });