How to add site search function to website using XHTML/HTML? [closed]

扶醉桌前 提交于 2019-12-03 21:37:07

You cannot provide a search function with just HTML and XHTML, unless you're just using a standardized form to get some external search engine (like Google) to do the work.

It is possible to do search with JavaScript, but that requires you to transfer all the data to the client, so it is not a very good idea.

If you want to write it yourself, you should use some server-side language, such as PHP or Python - it depends on what you have access to.

Check out Google Site Search.

There is no feature in HTML that will perform the search. But you do have 3 alternative options:

  1. You can integrate 3rd-party search engines like Google into your site. (Or see one of these examples.)
  2. You can upload a CGI page which uses PHP, Perl, or another scripting language to perform the local search for you.
  3. Lastly, there are some options for JavaScript search engines which work right inside the page.
Mike Comstock

Adding search to your site isn't nearly as simple as creating a search form: it also involves a bunch of programming. Depending on your experience level and what you are trying to do, it can be fun and rewarding to program simple search functionality to your site, but it can also be extremely time-consuming. If you want to take the easy route, use http://www.google.com/sitesearch/ as Jim suggested. If you want to make it yourself, see something like How would I implement a simple site search with php and mySQL? to get started.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!