【发布时间】:2019-05-17 02:49:25
【问题描述】:
我想访问表单和 div 中的输入元素。 我是 Google 应用脚本的新手,我相信我需要将包含 DOM 地址的参数从 JS 函数传递给应用脚本函数。
代码如下:
Javascript:
<script>
function update()
{
google.script.run.selectCell(document.getElementById(location));
alert("Success");//test message
}
</script>
HTML 代码:
<div class="container">
<form>
<div class="row">
<div class="col-25">
<label for="location">Location</label>
</div>
<div class="col-75">
<input type="text" id="location" name="location_txt" placeholder="The location..">
</div>
</div>
<div class="row">
<input type="button" onclick="update()" value="Update">
</div>
谷歌应用脚本:
function selectCell(domAddress)
{
var val0 = domAddress.value;
if (cell)
{
sheet.appendRow([val0]);
}
}
【问题讨论】:
标签: javascript html google-apps-script web-applications