下將目標設置爲_blank
:如何將target =「_ blank」添加到JavaScript window.location中?
if (key == "smk") {
window.location = "http://www.smkproduction.eu5.org";
target = "_blank";
done = 1;
}
但這似乎並沒有工作。如何在新標籤中啓動鏈接?
這裏是我的代碼:
function ToKey() {
var done = 0;
var key = document.tokey.key.value;
key = key.toLowerCase();
if (key == "smk") {
window.location = "http://www.smkproduction.eu5.org";
target = "_blank"
done = 1;
}
if (done == 0) {
alert("Kodi nuk është valid!");
}
}
<form name="tokey">
<table>
<tr>
<td>Type the key</td>
<td>
<input type="text" name="key">
</td>
<td>
</td>
<td>
<input type="button" value="Go" onClick="ToKey()">
</td>
</table>
</form>
所以你要在新窗口中打開鏈接? – Musa
Yepp ?!只有當鑰匙是正確的... –
'頭部'關閉? – Lucas