Window.close script doesn't seem to close

时间:2016-04-21 22:40:24

标签: html

Having trouble getting this code to actually close a window. Can anyone help? When the "return" is clicked it just goes to a blank page.

 <form method="post" action="http://ww8.aitsafe.com/cf/add.cfm" target="newWindow" onsubmit="window.open('', 'newWindow','width=800,height=500,'+'scrollbars=yes,status=no,toolbar=no,menubar=no,top=200,left=200')">
<p>
<input type="hidden" name="userid" value="A8403475">
<input type="hidden" name="return" value="window.close">
<input type="hidden" name="thumb" value="logo.png"> 
<select name="productpr">
<option>- Select Size -</option>
<option value="Size one:9.99">Size one - 9.99</option>
<option value="Size two:12.99">Size two - 12.99</option>
</select>
<input type="submit" value="Add to Cart">
</p>
</form>

1 个答案:

答案 0 :(得分:0)

在这种情况下,将代码定义为隐藏输入字段的值将无效

创建一个按钮并执行与此类似的操作:<button type="button" onclick="window.close();">Close</button>

您没有指定何时关闭窗口......