How can I add a Google search box to my website?

后端 未结 4 1559
无人共我
无人共我 2020-12-02 17:10

I am trying to add a Google search box to my own website. I would like it to search Google itself, not my site. There was some code I had that use to work, but no longer doe

4条回答
  •  独厮守ぢ
    2020-12-02 17:57

    No need to embed! Just simply send the user to google and add the var in the search like this: (Remember, code might not work on this, so try in a browser if it doesn't.) Hope it works!

    
    
    

        function search() {
        var Blah = document.getElementById("Blah").value;
        location.replace("https://www.google.com/search?q=" + Blah + "");
        }

提交回复
热议问题