三國紛爭
2023-08-05 21:05:44
我無法讓我的腳本正常工作。HTML 加載正常,但單擊按鈕時沒有執行任何操作,所以我認為 .addEventListener("click",function) 有問題,但我不知道是什么。我根本看不到記錄器中的任何內容。我以前寫過類似的網絡應用程序,但無法找到問題的根源;有人有什么想法嗎?function doGet(e){ return HtmlService.createTemplateFromFile("Form").evaluate();}function userClicked(clientInfo){ var ss = SpreadsheetApp.openById('Sheet_ID'); var ws = ss.getSheetByName('Form Inputs'); //Add new row for form submission ws.appendRow([clientInfo.clientName, clientInfo.partnerName, clientInfo.account_1, clientInfo.account_2, clientInfo.account_3]); //run newclient function newclient(clientInfo.clientName, clientInfo.partnerName, clientInfo.account_1, clientInfo.account_2, clientInfo.account_3); }//Function used in HTML file to generate HTML output from "page-js" and "page-css"function include(filename){return HtmlService.createHtmlOutputFromFile(filename).getContent();}HTML 如下:
3 回答

梵蒂岡之花
TA貢獻1900條經驗 獲得超5個贊
Logger.log
是一種僅在服務器端運行的 Apps 腳本方法 (code.gs)
對于來自客戶端 (Javascript) 的日志,請
console.log
改用。來自客戶端的控制臺日志不會出現在您的 Apps 腳本日志或執行中
您可以在瀏覽器的開發者控制臺中找到這些日志?
您的按鈕可能工作正常,但您的 Javascript 函數中存在一些錯誤
在這種情況下,您將在開發者控制臺中看到錯誤

胡說叔叔
TA貢獻1804條經驗 獲得超8個贊
您可以直接從谷歌應用腳本文檔嘗試這個:
var ui = DocumentApp.getUi();
var response = ui.alert('are you there?', ui.ButtonSet.OK);
// Process the user's response.
if (response == ui.ButtonSet.OK) {
Logger.log('The user clicked "OK."');
}
var ui = DocumentApp.getUi();
var response = ui.alert('are you there?', ui.ButtonSet.OK);
// Process the user's response.
if (response == ui.ButtonSet.OK) {
Logger.log('The user clicked "OK."');
}
添加回答
舉報
0/150
提交
取消