2015-01-08 100 views
0

我已经通过搜索来查看是否可以找到答案,我有点类似,但无法使其工作,因此我认为我错过了一些东西。在新窗口中打开网址/选项卡Javascript

我有一个链接,通过填充到表单的选项获取设置;我已经与window.open去了,但没有运气。对于我在这个问题上纯粹的白痴道歉。

<script> 
 
\t function process() 
 
\t { 
 
\t var url="http://postorder.ebay.co.uk/Cancel/Start?transId=" + document.getElementById("order_id").value + "&itemId=" + document.getElementById("item_id").value;location.href=url;return false; 
 
\t } 
 
</script>
\t \t <form id="ff" onSubmit="return process();"> 
 

 
\t   <label> 
 
\t \t \t <span>eBay Order ID*</span> 
 
\t \t \t <input type="text" placeholder="Please enter the Order ID" name="order_id" id="order_id" oninvalid="setCustomValidity('You know how to find the Order ID right?')" oninput="setCustomValidity('')" required autofocus> 
 
\t \t \t </label> 
 

 
\t \t \t <label> 
 
\t \t \t <span>eBay Item ID*</span> 
 
\t \t \t <input type="text" placeholder="Please enter the Item Number" name="item_id" id="item_id" oninvalid="setCustomValidity('You have the Order ID but this will not work without the Item Number')" oninput="setCustomValidity('')" required> 
 
\t \t \t </label> 
 

 
\t \t \t <input class="sendButton transition" type="submit" value="Submit"> 
 

 
\t \t </form>

回答

0

function OpenInNewTab(url) { var win = window.open(url, '_blank'); win.focus(); }

+0

刚试过似乎并没有工作,我曾见过类似的东西之前,这也似乎是徒劳的。它似乎不想打开一个新的窗口/选项卡。它只是在没有太多想法的情况下在同一个窗口中进行。 – Lee

相关问题