Provide zblog template_zblog them_wordpress template download and customization

The js code of one input box calling multiple search engines

Tianxing Studio 2019-08-17 21:42 Web special effects four thousand five hundred and twenty-one 1 Comments


The method to be implemented is as follows:

 One input box calls the js code of multiple search engines js code search engine web page special effects page 1

One input box input key word , multiple search engines can be called to search, and the implementation code is as follows:

 <div class="search clearfix"> <input type="text" name="q" id="bdcsMain" value="Enter keyword search" onfocus="if (value=='Enter keyword search ') {value=' '}" onblur="if (value==' ') {value='Enter keyword search'}"> <button class="search-bd" type="submit" onclick="window.open(' https://www.baidu.com/s?wd= '+document. getElementById ('bdcsMain'). value) ">Baidu</button> <button class="search-tb" type="submit" onclick="window.open(' http://ai.taobao.com/search/index.htm?pid=mm_ Your Taobao pid&amp; Key='+document. getElementById ('bdcsMain'). value) ">Taobao</button> <button class="search-by" type="submit" onclick="window.open(' http://cn.bing.com/search?q= '+document. getElementById ('bdcsMain'). value) ">Bing</button> </div>

With a section of js code, you can press Enter to call the first search by default:

 <script> $("# bdcsMain"). keydown (function (e) {//When the key is pressed If (e.which==13) {//. which attribute determines which key is pressed, and the key position number of the Enter key is 13 $('button.search-bd').trigger("click");// Click event that triggers the search button }   });   </script>

The css effect can be written according to your needs, and there is no limit to the number of search engines.


yes one Comments from netizens:

  •  visitor

    visitor Four years ago (2020-02-04) reply

    NIUBI was taught

welcome you Comment: Cancel Reply

 Please fill in the verification code
  • Latest articles
  • Hot article ranking
  • Most Comments
Label aggregation
  • Sign in
  • Registered account Forgot your password?
  • register
  • Already have an account? Direct login Forgot your password?
  • Social account login