我是使用Google脚本的新手,但对于编程并不是全新的。我看了一些例子,他们生成这样的HTML输出:
function doGet(e) {
return HtmlService.createHtmloutputFromFile('form.html')
}
我想将一个参数传递给我的脚本以在输出中使用它。我已经知道我可以在函数中使用它:
var room= e.parameter.room
所以当我用url执行我的脚本时?room = test我得到了该参数的值。
但是,如何使用我在HTML输出和其他代码中创建的可变空间?
我一直在看createTemplateFromFile,但我没有到达任何地方。
希望有人可以指出我正确的方向,看看构造和命令。
您可以直接获取客户端side1的查询参数:
<script>
google.script.url.getLocation(function(location) {
alert(location.parameter.room); //alerts "test" on loading "url?room=test"
});
</script>
或者,您可以使用scriptlet加载html qazxsw poi:
2
function doGet(e) {
var temp = HtmlService.createTemplateFromFile('form');
temp.room = e.parameter.room;
return temp.evaluate();
}