0
<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?

Bruno Gelb
  • 5,322
  • 8
  • 35
  • 50
  • possible duplicate of [Open a URL in a new tab using JavaScript](http://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-using-javascript) – Praveen Apr 19 '14 at 10:26

2 Answers2

2

you can write -

function process() {
    var url="http://google.com/?hl=en&q=" + document.getElementById("query").value;
    window.open(url, '_blank');
    return false;
}
Prabhat Jain
  • 346
  • 1
  • 8
0

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;
}
chandu
  • 2,276
  • 3
  • 20
  • 35