$(function(){
google.script.run
.withSuccessHandler(upDateToDaysDate)
.getTodaysDate();//this code
google.script.run
.withSuccessHandler(upDateLastRecipient)
.getLastEmailRecipient();//this was already there
});
我在它上面添加了这个函数,因为它似乎必须在使用之前定义函数 .
function upDateToDaysDate(s){
app.pages.Email.descendants.TodaysDate.value=s;
}
然后在服务器脚本中我添加了这个函数:
function getTodaysDate(){
return Utilities.formatDate(new Date(),Session.getScriptTimeZone(),"E MMM d, yyyy");//for time just add HH:mm:ss to the format parameter
}
1 回答
在页面刷新时自动加载文本小部件
好吧,我对appmaker有点新意,所以这不一定是最简单的方法 . 但这很有效 . 我在屏幕上添加了一个名为todaysDate的新文本小部件,如下所示:
然后我进入了客户端脚本并将此代码添加到ready函数中 .
我在它上面添加了这个函数,因为它似乎必须在使用之前定义函数 .
然后在服务器脚本中我添加了这个函数: