Google apps脚本:样式标签在index.html中工作,但在stylesheet.html中不起作用



我是GAS的新手,所以请原谅我愚蠢的问题…

我非常简单的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);
}

没有总是包含的页面,您必须指定它,就像在良好实践中所说的:

在code.gs:

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

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

最新更新