啟用自動完成功能
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
除了在控制台中自訂顏色、字型或連結樣式之外,
也可能影響圖片的外觀和風格
自訂 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>
注意:新啟用或新增的自動完成建議功能可能要幾小時後才能出現。
還有許多其他選擇可以選擇。你可以閱讀其他搜尋框的相關資訊
自訂選項
Programmable Search Element Control API 一節。
如要進一步瞭解自動完成建議,請參閱有關自動完成功能的說明中心文章。
下一步...
繼續自訂搜尋結果。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間: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)."]]