很抱歉,我对编码一无所知,但我迫切希望创建一个特定的功能。我想在Google中创建一个检查表,当选中不同的复选框时,它会自动提示电子邮件通知到不同的地址。Google脚本能做到这一点吗?不知怎么能帮我理解?谢谢!
史考特,
发布于 2022-03-20 02:03:11
电子邮件对话框
Code.gs:
function displayCheckBoxes(chA) {
var ss=DocumentApp.getActiveDocument();
var html='';
for(var i=0;i<chA.length;i++) {
html+=Utilities.formatString('<br />%s', chA[i].value);
}
var userInterface=HtmlService.createHtmlOutput(html);
DocumentApp.getUi().showModelessDialog(userInterface, 'Checked Boxes');
}
function launchCheckboxDialog() {
DocumentApp.getUi().showModelessDialog(HtmlService.createHtmlOutputFromFile('ah1'),'Email Dialog');
}html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<input type="checkbox" id="chk1" name="Checks" value="Email 1 Sent" /><label for="chk1">Send Email 1</label>
<br /><input type="checkbox" id="chk2" name="Checks" value="Email 2 Sent" /><label for="chk2">Send Email 2</label>
<br /><input type="checkbox" id="chk3" name="Checks" value="Email 3 Sent" /><label for="chk3">Send Email 3</label>
<br /><input type="button" id="chkbtn" value="Send Selected Emails" onClick="saveChecks();" />
<script>
function saveChecks() {
var chA=document.querySelectorAll('input[type="checkbox"][name="Checks"]:checked');
var cbA=[];
console.log('Checkboxes: %s',JSON.stringify(chA));
for(var i=0;i<chA.length;i++) {
console.log('id: %s name: %s value: %s',chA[i].id,chA[i].name,chA[i].value);
cbA.push({id:chA[i].id,name:chA[i].name,value:chA[i].value});
}
google.script.run.displayCheckBoxes(cbA);
}
</script>
</body>
</html>演示:

https://stackoverflow.com/questions/71538899
复制相似问题