启用自动补全
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
除了在控制面板中自定义颜色、字体或链接样式外,
可以影响广告的外观和风格以及广告行为
通过自定义 HTML 属性访问搜索框。
这可让您覆盖控制台中的一些常规设置。
当您想要一个搜索框(例如,首页上的搜索框)时,此功能特别有用
的行为方式与网站上的其他网页不同。
例如,您可以使用
enableAutoComplete
属性。默认设置为
true
(如果在控制台中启用了自动补全功能)。修改者
将值切换为 false
,即可控制元素
行为。
<!-- 在此插入您自己的可编程搜索引擎 ID -->
<script async src="https://cse.google.com/cse.js?cx=017643444788069204610:4gvhea_mvga"></script>
<!-- 尝试将属性值切换为“true”或“false”-->
<div class="gcse-search" enableAutoComplete="true"></div>
注意:新启用或添加的自动补全查询可能要过几个小时才会显示。
还有很多其他选项可供选择。您可以了解其他搜索框
中的自定义选项
<ph type="x-smartling-placeholder"></ph>
Programmable Search Element Control API 部分。
如需详细了解自动补全功能,请参阅介绍自动补全的帮助中心文章。
下一个...
继续阅读自定义搜索结果。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eCustomize the search box's look, feel, and behavior using custom HTML attributes, overriding general Control Panel settings.\u003c/p\u003e\n"],["\u003cp\u003eControl individual search boxes differently, like enabling or disabling autocomplete for specific instances using the \u003ccode\u003eenableAutoComplete\u003c/code\u003e attribute.\u003c/p\u003e\n"],["\u003cp\u003eExplore additional search box customization options in the Programmable Search Element Control API documentation.\u003c/p\u003e\n"],["\u003cp\u003eNewly enabled or added autocompletions may require several hours to become visible.\u003c/p\u003e\n"],["\u003cp\u003eLearn more about Autocompletions in the dedicated Help Center article.\u003c/p\u003e\n"]]],[],null,["# Enabling Autocomplete\n\nApart from customizing colors, fonts or link style in the [Control Panel](https://programmablesearchengine.google.com),\nit is possible to influence the look and feel and the behavior of\nthe search box via custom HTML attributes.\n\nThis allows you to override some of the general settings from Control Panel.\nIt is especially useful when you want one search box (e.g. one on the homepage)\nto behave differently than other ones on the site.\nFor example, you can enable or disable autocomplete feature using\n`enableAutoComplete` attribute. By default, it is set to\n`true` if autocomplete is enabled in the Control Panel. By\nswitching the value to `false` you can control how the element\nbehaves. \n\\\u003c!-- Insert your own Programmable Search Engine ID here --\\\u003e \\\u003cscript async src=\"https://cse.google.com/cse.js?cx=017643444788069204610:4gvhea_mvga\"\\\u003e\\\u003c/script\\\u003e \\\u003c!-- Try switching the attribute value to \"true\" or \"false\" --\\\u003e \n\n \u003cdiv class=\"gcse-search\" enableAutoComplete=\"true\"\u003e\u003c/div\u003e\n\nNote: Newly enabled or added autocompletions may take several hours to appear.\n\nThere are many more options available. You can read about other search box\ncustomization options in\n[Programmable Search Element Control API](/custom-search/docs/element#supported_attributes) section.\n\nFor more information on Autocompletions, please see the [Help Center article](https://support.google.com/programmable-search/answer/2631081) on Autocomplete.\n\nNext...\n-------\n\nContinue to [Customizing search results](/custom-search/docs/tutorial/customizingresults)."]]