Home > Backend Development > PHP Tutorial > window.open的第三个参数设置了不生效

window.open的第三个参数设置了不生效

WBOY
Release: 2016-06-23 13:49:43
Original
1856 people have browsed it

PHP里面的一段代码:

<form action='/phpinfo.php' method='POST'     	target=window.open("http://<?php echo gethostbyname($_SERVER["SERVER_NAME"]);?>","","height=400, weight=300")>            <input type='hidden' value=<?php echo $node->getId() ?> name='nodeIdinfo'>            <input type="submit" value="AP信息" name='showNdinfo'>        </form>
Copy after login


打开新网页之后,网页还是全屏大小显示,而不是400*300显示。

求教,这里怎么写,才能将新打开的网页按自己要求的大小显示?


回复讨论(解决方案)

set了viewport?

$("form").click(function(){
  window.open("page.html","","width=200,height=200")
})

$("form").click(function(){
  window.open("page.html","","width=200,height=200")
})


--------------------------------------------------------------------------------------
这是jQuery?这样的话,我本身form表单里的window.open不就白写了么?

window.open不放在target里。
这样就可以了

<form action='/phpinfo.php' method='POST' target="popwin">    <input type='hidden' value=<?php echo $node->getId() ?> name='nodeIdinfo'>    <input type="submit" value="AP信息" name='showNdinfo' onclick="window.open('http://<?php echo gethostbyname($_SERVER["SERVER_NAME"]);?>','popwin','height=400, width=300')"></form>
Copy after login
Copy after login

window.open不放在target里。
这样就可以了

<form action='/phpinfo.php' method='POST' target="popwin">    <input type='hidden' value=<?php echo $node->getId() ?> name='nodeIdinfo'>    <input type="submit" value="AP信息" name='showNdinfo' onclick="window.open('http://<?php echo gethostbyname($_SERVER["SERVER_NAME"]);?>','popwin','height=400, width=300')"></form>
Copy after login
Copy after login


------------------------------------------------------------------------------------------------------------------------
可以了,多谢~~

$("form").click(function(){
      window.open("page.html","","width=200,height=200") 
})


-------------------------------------------------------------------------------------------
你的我没试,不知道行不行,主要是楼下把代码贴全了,我直接复制就懒得敲了~~
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template