Open in new tab (target="blank")

I would like to open a page in a new tab, using target="blank". Where would I put that?

<head>
<script type="text/javascript">
<!--
function gotoURL() {
var newURL = ("http://tulyita.hu/pr2info.php?name=" + document.url2go.go.value)
document.location.href=newURL
}
//-->
</script>
</head>
<pre><center>

<form action="javaScript:gotoURL()" method="get" name="url2go">
<input type="text" name="go" value="" size="50">
<input type="submit" value="Ok">
</form>

<title>PR2 Checker GIF</title>
</center></body>

Upvotes: 0

Views: 4759

Answers (3)

Rickard Sundin
Rickard Sundin

Reputation: 111

Modify your function to

function gotoURL() {
    var newURL = "http://tulyita.hu/pr2info.php?name=" + document.url2go.go.value;
    window.open(newURL, "_blank");
}

Upvotes: 0

Raghu
Raghu

Reputation: 2563

Try using this in your JavaScript function:

window.open("http://tulyita.hu/pr2info.php?name=" + document.url2go.go.value, "_blank");

Upvotes: 2

Rahul Tripathi
Rahul Tripathi

Reputation: 172578

Try this:-

<form action="javaScript:gotoURL()" target="_blank" method="get" name="url2go">

Although some browsers handles this case depends up to the settings. For example in IE9 you may need to change the setting of the browser.

or modify yoour function like this:-

 function gotoURL() {
 var newURL = ("http://tulyita.hu/pr2info.php?name=" + document.url2go.go.value)
 window.open(newURL,'_blank');
 }

Upvotes: 1

Related Questions