0
這裏是我的谷歌的部分Google Apps腳本的HTML模板:谷歌Apps腳本的HTML模板的SyntaxError
<? if (filter == "ticket"){ var feedback = sortFeedbackByDate(getRecentTicketFeedback()); }
else if (filter == "all"){ var feedback = sortFeedbackByDate(getAllRecentFeedback()); }
else { var feedback = getRecentBomgarFeedback(); }
var percHappy = getNumHappy(feedback)/feedback.length;
var percOK = getNumOK(feedback)/feedback.length;
var percSad = getNumSad(feedback)/feedback.length; ?>
當此模板調用引用代碼(),這部分如下:
if (filter == "ticket"){ ;
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=ticket" ; output._ = '\">Ticket Feedback</option>\n';
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1" ; output._ = '\">Bomgar Feedback</option>\n';
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=all" ; output._ = '\">All Feedback</option>\n';
output._ = ' '; } else if (filter == "all" { ;
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=ticket" ; output._ = '\">Ticket Feedback</option>\n';
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=all" ; output._ = '\">All Feedback</option>\n';
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1" ; output._ = '\">Bomgar Feedback</option>\n';
output._ = ' '; } else { ;
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1" ; output._ = '\">Bomgar Feedback</option>\n';
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=ticket" ; output._ = '\">Ticket Feedback</option>\n';
output._ = ' <option value=\"'; output._ = ScriptApp.getService().getUrl()+"?page=1&filter=all" ; output._ = '\">All Feedback</option>\n';
output._ = ' '; } ;
如您所見,在模板中存在以下行:
else if (filter == "all"){
這被看作是從調用getCode()
else if (filter == "all" {
這顯然會導致語法錯誤。我是否在這裏犯過一些錯誤,或者這是js代碼生成中的錯誤?
感謝