Reputation: 1
<script>
function process()
{
var url="http://google.com/?hl=en&q=" + document.getElementById("query").value;
location.href=url;
return false;
}
</script>
<form onSubmit="return process();" target="_blank">
query: <input type="text" name="query" id="query">
<input type="submit" value="go">
</form>
How to process this on new tab?
Upvotes: 0
Views: 1289
Reputation: 2276
place window.open(url,"_blank") insted of location.href=url;
<script>
function process()
{
var url="http://google.com/?hl=en&q=" + document.getElementById("query").value;
window.open(url,"_blank");
return false;
}
Upvotes: 0
Reputation: 346
you can write -
function process() {
var url="http://google.com/?hl=en&q=" + document.getElementById("query").value;
window.open(url, '_blank');
return false;
}
Upvotes: 2