【发布时间】:2014-06-02 07:02:03
【问题描述】:
首先,我的编码:
code.gs
var ui = DocumentApp.getUi();
function showSidebar() {
var html = HtmlService.createHtmlOutputFromFile('index')
.setTitle('My custom sidebar').setWidth(300);
ui.showSidebar(html);
}
以上代码在 Google Doc 中打开侧边栏。
index.html
<div>
<input type="button" value="Name"
onclick="google.script.run.updateinput()" />
<input id="name">
</div>
此代码添加一个按钮作为名称,该按钮运行下一组代码并向侧边栏添加一个输入框
function updateinput() {
var app = UiApp.getActiveApplication();
Logger.log("Clicked")
app.getElementById("name").value("This is inputbox")
}
问题:
在单击名称按钮时,记录器会记录 Clicked 的值,但是,如何获取输入框以获取值“这是输入框”。请提出建议。
执行脚本显示以下错误“执行失败:TypeError:Cannot find function value in object Generic。”
【问题讨论】:
标签: javascript html google-apps-script google-apps