[英]Button in Custom Dialog does not work (Google Apps Script)
I have a custom dialog box with a Next button that is supposed to trigger an alert box to appear. 我有一个自定义对话框,其中有一个Next按钮,可以触发一个警告框出现。 However nothing happens when I click on Next.
但是当我点击Next时没有任何反应。
Code.gs: Code.gs:
function createInvoice() {
var htmlOutput = HtmlService
.createHtmlOutputFromFile("CreateInvoice1");
SpreadsheetApp.getUi().showModalDialog(htmlOutput, "Create New Invoice");
}
CreateInvoice1.html: CreateInvoice1.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<form id="CreateInvoice1form">
<div class="block form-group">
<label for="select"> Select Client:</label>
<select id="select">
<option value="Cl01">Client 1</option>
<option value="Cl02">Client 2</option>
</select>
</div>
<br><br>
<input type="button" value="Next" onclick="Next1()">
<input type="button" value="Close" onclick="google.script.host.close()">
</form>
<script>
function Next1() {
var selectedClient = document.getElementbyId("select").value;
SpreadsheetApp.getUi().alert("You are making an invoice for"+selectedClient);
}
</script>
</body>
</html>
Solution (.html) 解决方案(.html)
<head>
<script>
function Next1() {
var selectedClient = document.getElementById("select").value;
alert("You are making an invoice for"+selectedClient);
}
</script>
</head>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.