【问题标题】:_target = blank and window size_target = 空白和窗口大小
【发布时间】:2012-09-17 01:44:00
【问题描述】:

我的目标是在 IE8 的新窗口中启动一些页面。我正在使用 _target = blank ,但结果窗口的开始六是像 300X400。所以,我的问题是:如果我使用 _target = black,我是否能够管理浏览器结果窗口的大小?

更新:如果可能的话,我需要没有 js 的解决方案

【问题讨论】:

  • 你可以尝试做一个<frame> old style
  • 但这不会是一个新窗口
  • 这个框架可以在当前页面之外启动吗?
  • 我不确定你是否能够在没有 JS 的情况下做你需要的事情。
  • 可能,这是我问题的正确答案。谢谢!

标签: asp.net html internet-explorer


【解决方案1】:

试试这样的:

<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'name','height=190,width=520,top=200,left=300,resizable');
if (window.focus) {newwindow.focus()}
}
</script>

HTML:

<a href='...' onClick='showPopup(this.href);return(false);'>Info</a>

【讨论】:

  • 这是一个很好的解决方案,但不是我的情况;我需要使用_target = blank,换句话说,我不允许使用js作为解决方案。对不起..
  • 我认为只有 html 和 css 你不能做你想做的事
【解决方案2】:

没有 JavaScript,这是不可能的。所以,这里是代码!

<a onclick="window.open('http://www.google.com','nyWindow','width=300,Height=400');">Open Window</a>

希望对你有帮助...

【讨论】:

    【解决方案3】:

    试试这个

      <a href="#" onclick="window.open('google.com','height=100,width=100');return false;">test</a> 
    

    【讨论】:

      【解决方案4】:

      这里是如何使用 JQuery 完成的:

             <script type="text/javascript">
              var windowSizeArray = [ "width=200,height=200",
                                      "width=300,height=400,scrollbars=yes" ];
      
              $(document).ready(function(){
                  $('.newWindow').click(function (event){
      
                      var url = $(this).attr("href");
                      var windowName = "popUp";//$(this).attr("name");
                      var windowSize = windowSizeArray[$(this).attr("rel")];
      
                      window.open(url, windowName, windowSize);
      
                      event.preventDefault();
      
                  });
              });
          </script>
      
          <a href="http://www.Zakharko.com/" rel="0" class="newWindow" >open me</a>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多