2012-10-02 26 views

回答

3

如果使用

function doGet(e) { 
    if (e.parameter.messageID) { // Simply test if the parm messageID exists 

基礎上,你可以測試參數的URL傳遞的參數您加載不同的頁面你總是可以做這樣的事情太

switch (v) { 
    case "A": var t = HtmlService.createTemplateFromFile("A"); break; 
    case "B": var t = HtmlService.createTemplateFromFile("B"); break; 
} 
return t.evaluate(); 

我的最後一個選項是您可以將條件邏輯放入模板以獲得不同的HTML

// GAS file 
var t = HtmlService.createTemplateFromFile("A"); 
var v = "A"; 
t.v = v; // pass the variable v to the template 
return t.evaluate(); 

// A.html template file 
<? if (v == "A") { ?> 
    <b>a bold A</b> 
<? } else { ?> 
    <b>not a A but bold anyway </b> 
<? } ?> 
+1

謝謝。因此,如果我首先加載index.html,那麼如何重新加載doGet以重新評估上面的條件? –

相關問題