Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
提供意見
Enum ButtonSet
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
ButtonSet
列舉代表一或多個預先決定的本地化對話方塊按鈕組合,
新增至 alert 或 prompt 。若要判斷使用者點選的是哪個按鈕
使用 Button 。
如要呼叫列舉,您可以呼叫其父項類別、名稱和屬性。例如
Base.ButtonSet.OK。
// Display a dialog box with a message and "Yes" and "No" buttons.
const ui = DocumentApp . getUi ();
const response = ui . alert (
'Are you sure you want to continue?' ,
ui . ButtonSet . YES_NO ,
);
// Process the user's response.
if ( response === ui . Button . YES ) {
Logger . log ( 'The user clicked "Yes."' );
} else {
Logger . log ( 'The user clicked "No" or the dialog\'s close button.' );
}
屬性
屬性 類型 說明
OKEnum一個「確定」按鈕,用於表示只能關閉的資訊訊息。
OK_CANCELEnum一個「確定」按鈕和「取消」讓使用者繼續或停止
作業。
YES_NOEnum「是」「否」的按鈕,可讓使用者回答是/否問題。
YES_NO_CANCELEnum「是」則會看到「否」按鈕和「取消」因為使用者可以利用這個按鈕
是/否問題或暫停作業。
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-04-13 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-04-13 (世界標準時間)。"],[],[]]