由于我想要一个更像搜索引擎的应用程序,所以我使用了自定义search.ai。但是,在生产环境中,我看到查询和订阅键,我不得不进入。我想要这些代码,所以请你解释一下我是如何得到它们的。非常感谢您的帮助!
发布于 2021-07-09 06:23:53
您可以使用:
<form method="GET" action="https://www.bing.com" target="_blank">
Search Bing: <input type="text" name="q" placeholder="Search..."/>
<input type="submit" value="Search"/>
</form>
,如果您想进行自定义站点搜索,则可以使用。
var q = document.getElementById("query");
var val= document.getElementById('hidden').value = "+site:reddit.com";
document.getElementById('search').onclick = function() {
window.location.href='http://bing.com/search?q='+q.value+val;
};
// Submitting value when 'Enter' is pressed
document.addEventListener("keydown", event => {
if (event.isComposing || event.keyCode !== 13) {
return;
}
window.location.href='http://bing.com/search?q='+q.value+val;
});<input id="query" type="text" name="q" maxlength="255" placeholder="Search in the site" value="">
<input id="hidden" name="q" type="hidden">
<input id="search" name="q" maxlength="255" placeholder="Search in the site" type="button" value="Search">
您也可以使用它直接打开images**,**videos**,等。**
https://stackoverflow.com/questions/68311085
复制相似问题