我有一个带有“下一步”按钮的自定义对话框,该按钮应该触发一个警报框出现。但是,当我单击“下一步”时,没有任何反应。
Code.gs:
function createInvoice() {
var htmlOutput = HtmlService
.createHtmlOutputFromFile("CreateInvoice1");
SpreadsheetApp.getUi().showModalDialog(htmlOutput, "Create New Invoice");
}
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>
答案 0 :(得分:0)
解决方案(.html)
<head>
<script>
function Next1() {
var selectedClient = document.getElementById("select").value;
alert("You are making an invoice for"+selectedClient);
}
</script>
</head>