【发布时间】:2016-09-13 18:52:33
【问题描述】:
我正在尝试使用外部 CSS 样式表。然而,我得到的是 '* include stylesheet *' 在我的 html 侧边栏中呈现。我在我的 code.gs 文件中创建了包含函数。为什么这不起作用?
Index.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<?!= include('stylesheet'); ?>
</head>
<body>
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
</body>
</html>
代码.gs
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Form')
.addItem('Open', 'openSidebar')
.addToUi();
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
function openSidebar(){
var htmlOutput = HtmlService.createHtmlOutputFromFile('Index');
htmlOutput.setTitle('Customer Inquiry Form');
SpreadsheetApp.getUi().showSidebar(htmlOutput);
}
stylesheet.html
<style>
body{
background-color:'gray';
}
</style>
【问题讨论】:
标签: javascript html css google-apps-script