2015-01-08 97 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

相關問題