【发布时间】:2020-10-26 13:20:05
【问题描述】:
我想将 gs 代码中的 2 个变量的值设置为 HTML 文件的 2 个文本区域中的文本值。
sidebar.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<input type="button" value="go go go!" onclick="google.script.run.mainFunction();"/>
<strong>Text Area 1</strong>
<textarea id="textarea1" rows="2" cols="35">Text1</textarea>
<strong>Text Area 2</strong>
<textarea id="textarea2" rows="3" cols="35">Text2</textarea>
</body>
</html>
code.gs:
mainFunction() {
var textArea1Value = ???; // should be "Text1"/user's input
var textArea2Value = ???; // should be "Text2"/user's input
// some code
}
我如何实现这一目标? (我应该写什么而不是gs代码中的“???”?)
我已尝试寻找解决方案,但由于答案过于具体,我不确定如何实施我的发现
谢谢
【问题讨论】:
标签: html user-interface google-apps-script google-docs