Class Browser

瀏覽器

本課程提供存取 Google 試算表特有的對話方塊。

此類別中的方法只能用於 Google 試算表。 請改用 Google Workspace 對話方塊

另請參閱

屬性

屬性類型說明
ButtonsButtonSet

方法

方法傳回類型簡短說明
inputBox(prompt)String在使用者的瀏覽器中,顯示內含文字輸入框的對話方塊。
inputBox(prompt, buttons)String在使用者的瀏覽器中,顯示內含文字輸入框的對話方塊。
inputBox(title, prompt, buttons)String在使用者的瀏覽器中,顯示內含文字輸入框的對話方塊。
msgBox(prompt)String彈出對話方塊,內含指定訊息,在使用者瀏覽器中顯示 [確定] 按鈕。
msgBox(prompt, buttons)String在使用者瀏覽器中彈出對話方塊,內含指定訊息和指定按鈕。
msgBox(title, prompt, buttons)String在使用者的瀏覽器中彈出對話方塊,內含指定標題、訊息和指定按鈕。

內容詳盡的說明文件

inputBox(prompt)

在使用者的瀏覽器中,顯示內含文字輸入框的對話方塊。

inputBox 方法會引發用戶端輸入框,並在 內容。請注意,此函式會導致伺服器端指令碼暫停。繼續計時 當使用者清除對話方塊後,系統會自動儲存 JDBC 連線,但 JDBC 連線不會保留 停權。

// The code below sets the value of name to the name input by the user, or 'cancel'.
var name = Browser.inputBox('Enter your name');
敬上 我們不建議採用這個方法。請改用使用者介面提示

參數

名稱類型說明
promptString對話方塊中顯示的文字。

回攻員

String:使用者輸入的文字 (取消或關閉的對話方塊則為「取消」)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

inputBox(prompt, buttons)

在使用者的瀏覽器中,顯示內含文字輸入框的對話方塊。

inputBox 方法會引發用戶端輸入框,並在 並提供多種顯示按鈕。請注意,這個函式會使 暫停使用。在使用者清除對話方塊後會自動恢復。 但 JDBC 連線在停權期間不會持續存在。

// The code below sets the value of name to the name input by the user, or 'cancel'.
var name = Browser.inputBox('Enter your name', Browser.Buttons.OK_CANCEL);
敬上 我們不建議採用這個方法。請改用使用者介面提示

參數

名稱類型說明
promptString對話方塊中顯示的文字。
buttonsButtonSet設定的按鈕類型。

回攻員

String:使用者輸入的文字 (取消或關閉的對話方塊則為「取消」)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

inputBox(title, prompt, buttons)

在使用者的瀏覽器中,顯示內含文字輸入框的對話方塊。

inputBox 方法會提出含有指定標題的用戶端輸入方塊,以顯示 並提供要顯示的按鈕選項。請注意,此 函式會暫停伺服器端指令碼。且在使用者結束就會自動恢復運作 可清除對話方塊,但暫停期間不會保留 JDBC 連線。

// The code below sets the value of name to the name input by the user, or 'cancel'.
var name = Browser.inputBox('ID Check', 'Enter your name', Browser.Buttons.OK_CANCEL);
敬上 我們不建議採用這個方法。請改用使用者介面提示

參數

名稱類型說明
titleString對話方塊的標題。
promptString對話方塊中顯示的文字。
buttonsButtonSet設定的按鈕類型。

回攻員

String:使用者輸入的文字 (取消或關閉的對話方塊則為「取消」)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

msgBox(prompt)

彈出對話方塊,內含指定訊息,在使用者瀏覽器中顯示 [確定] 按鈕。

msgBox 方法會引發用戶端訊息方塊,顯示指定訊息給 內容。請注意,這個方法會導致伺服器端指令碼暫停。繼續計時 當使用者清除對話方塊後,系統會自動儲存 JDBC 連線,但 JDBC 連線不會保留 停權。

// The code below displays "hello world" in a dialog box with an OK button
Browser.msgBox('hello world');
敬上 我們不建議採用這個方法。請改用「UI 快訊」對話方塊。

參數

名稱類型說明
promptString對話方塊中顯示的文字。

回攻員

String:使用者點選的按鈕文字全小寫 (如果是小寫的,則為「cancel」) 已關閉對話方塊)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

msgBox(prompt, buttons)

在使用者瀏覽器中彈出對話方塊,內含指定訊息和指定按鈕。

msgBox 方法會引發用戶端訊息方塊,顯示指定訊息給 並提供多種顯示按鈕。請注意,這個方法會導致 暫停使用。在使用者清除對話方塊後會自動恢復。 但 JDBC 連線在停權期間不會持續存在。

// The code below displays "hello world" in a dialog box with OK and Cancel buttons.
Browser.msgBox('hello world', Browser.Buttons.OK_CANCEL);
敬上 我們不建議採用這個方法。請改用「UI 快訊」對話方塊。

參數

名稱類型說明
promptString對話方塊中顯示的文字。
buttonsButtonSet設定的按鈕類型。

回攻員

String:使用者點選的按鈕文字全小寫 (如果是小寫的,則為「cancel」) 已關閉對話方塊)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

msgBox(title, prompt, buttons)

在使用者的瀏覽器中彈出對話方塊,內含指定標題、訊息和指定按鈕。

msgBox 方法會提出含有指定標題的用戶端訊息方塊,顯示 並提供要顯示的按鈕選項。請注意,此 方法,即可暫停伺服器端指令碼。且在使用者結束就會自動恢復運作 可清除對話方塊,但暫停期間不會保留 JDBC 連線。

// The code below displays "hello world" in a dialog box with a custom title and Yes and
// No buttons
Browser.msgBox('Greetings', 'hello world', Browser.Buttons.YES_NO);
敬上 我們不建議採用這個方法。請改用「UI 快訊」對話方塊。

參數

名稱類型說明
titleString對話方塊的標題。
promptString對話方塊中顯示的文字。
buttonsButtonSet設定的按鈕類型。

回攻員

String:使用者點選的按鈕文字全小寫 (如果是小寫的,則為「cancel」) 已關閉對話方塊)。

授權

使用這個方法的指令碼需要下列一或多個範圍的授權:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets