How can make a program so as to get Search Results in another Window

I am udemy learner of javascript and In one the recent classes I learnt how to format url string the using javacscript.

Now I want to make a program in which user enters the string (say - harry potter) in form text input field and then on clicking button it redirects to second page and display that string search in BING search engine.

I tried to write some code but I failed. Can anybody help me ??

Following are the files I made

1 answer

  • answered 2018-02-13 03:13 ezakto

    <input type="text" id="myinput">
    <input type="submit">
      document.forms[0].onsubmit = function() {
        var query = document.getElementById('myinput').value;'' + encodeURIComponent(query));
        return false;