如何让我的Javascript表单在提交时在新窗口中打开

如何让我的Javascript表单在提交时在新窗口中打开,javascript,forms,submit,Javascript,Forms,Submit,现在它只在同一个窗口中打开,我希望它在提交后在新窗口中打开 下面是脑袋里的东西: <script type="text/javascript"> function getURL(val){ base = 'http://www.domain.com/'; location = base + val; return false; } </script> <form id="form1" name="form1" method="post" action

现在它只在同一个窗口中打开,我希望它在提交后在新窗口中打开

下面是脑袋里的东西:

<script type="text/javascript"> 
function getURL(val){ 
base = 'http://www.domain.com/'; 
location = base + val; 
return false; 
} 
</script> 
<form id="form1" name="form1" method="post" action="" onsubmit="return getURL(this.url.value)"> 
<label> 
<input type="text" name="url" /> 
</label> 
<label> 
<input type="submit" name="Submit" value="Submit" /> 
</label> 
</form> 

函数getURL(val){
基地组织http://www.domain.com/'; 
位置=基准+val;
返回false;
} 
以下是身体里的东西:

<script type="text/javascript"> 
function getURL(val){ 
base = 'http://www.domain.com/'; 
location = base + val; 
return false; 
} 
</script> 
<form id="form1" name="form1" method="post" action="" onsubmit="return getURL(this.url.value)"> 
<label> 
<input type="text" name="url" /> 
</label> 
<label> 
<input type="submit" name="Submit" value="Submit" /> 
</label> 
</form> 


进一步阅读:


如果您想在javascript中执行此操作,但可能会被弹出窗口阻止程序阻止

window.open(location);

嗯,window.open()或只设置目标和操作。可能重复的请在询问“不起作用”之前搜索以前回答的问题…它会将表单提交到新窗口,但不会将其带到他们要去的位置。为什么?它位于“在新窗口或选项卡中显示收到的响应”。