2015-07-05 49 views
2

我在氣體的小白,所以請原諒我的愚蠢的問題......當它是一部分谷歌Apps腳本:風格標籤index.html的工作,但不stylesheet.html

我很簡單的CSS風格的作品的index.html,但不是stylesheet.html的一部分。我究竟做錯了什麼?提前致謝!

的index.html

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"> 
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> 

<script> 
    $(function() { 
    $("#studPropTabs").tabs(); 
    }); 
</script> 

<div id="studPropTabs"> 
    <ul> 
    <li><a href="#mainTab">Basic Information</a></li> 
    <li><a href="#schedTab">Schedule & Course Drops</a></li> 
    <li><a href="#planTab">Planning</a></li> 
    <li><a href="#miscTab">Off-campus & Partner Info</a></li> 
    </ul> 
    <div id="mainTab"> 
    <form id='propForm'> 
     <fieldset> 
     <div> 
      <label class='mainForm' for='firstName' >First Name</label> 
      <input type='text' id='firstName' /> 
     </div> 
     <div> 
      <label class='mainForm' for='lastName' >Last Name</label> 
      <input type='text' id='lastName' /> 
     </div> 
     </fieldset> 
    </form> 
    </div> 

</div> 

stylesheet.html

<!-- This CSS package applies Google styling; it should always be included. --> 
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css"> 

<style> 

label { 
display: inline-block; 
width: 5em; 
color: red; 
} 

</style> 

code.gs

function doGet(e) { 
    return HtmlService.createHtmlOutputFromFile('Index') 
    .setTitle('Senior Project Proposal Form') 
    .setSandboxMode(HtmlService.SandboxMode.IFRAME); 
} 

回答

1

毫無頁,我老是包括在內,則必須指定它,就像在Good Practices說:

在code.gs:

function include(filename) { 
    return HtmlService.createHtmlOutputFromFile(filename) 
     .setSandboxMode(HtmlService.SandboxMode.IFRAME) 
     .getContent(); 
} 

index.html中:

<?!= include('Stylesheet'); ?> 
+1

感謝您的幫助!我得到它的工作,但只有當我使用模板HTML。所以...如果你想引用Stylesheet.html,你必須使用模板而不是HtmlOutput。這是我的困惑來自的地方。 –