在新窗口/选项卡中打开URL Javascript

时间:2015-01-08 15:28:24

标签: tabs

我已经搜索了SO,看看我是否能找到答案而且我已经找到了答案,但是无法让它发挥作用所以我认为我错过了一些东西。

我有一个链接,可以通过填写到表单中的选项进行设置;我曾经去过window.open,但没有运气。对我在这个问题上的纯粹愚蠢道歉。

<script>
	function process()
	{
	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;
	}
</script>
		<form id="ff" onSubmit="return process();">

	        <label>
			<span>eBay Order ID*</span>
			<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>
			</label>

			<label>
			<span>eBay Item ID*</span>
			<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>
			</label>

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

		</form>

1 个答案:

答案 0 :(得分:0)

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