HTMLOutの前にdoGet()のhtmlファイルを変更する必要があります。しかし、htmlファイルには<?!=include('css').getContent();?>
があり、実行できず、HTMLテキストの一部になります。あなたの助けに感謝?ここにコードがあります。ここでGoogle Apps ScriptのHTMLOutputの前にhtmlファイルを変更する方法
function doGet(e) {
var landingPage;
landingPage=e.parameter.page ||'index';
var html=HtmlService.createHtmlOutputFromFile(landingPage);
var content=html.getContent();
content=content.replace("%%ToBeChanged%%","New Value");
var html2=HtmlService.createTemplate(content);
return html2.evaluate()
.setTitle('testing Website')
.addMetaTag('viewport', 'width=device-width, initial-scale=1')
}
あなただけのいくつかのCSSとJavaScriptでページをロードしようとしている場合は、プロジェクト
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>TITLE</title>
<?!=HtmlService.createHtmlOutputFromFile('styleSheet').getContent(); ?>
<?!=HtmlService.createHtmlOutputFromFile('script').getContent(); ?>
</head>
<body>
<form>
<input type='text' value='##ToBeChanged##'>
</form>
</body>
</html>
スクリプトレットには、関数名 'include()'があります。 'function include(){return theHtml} 'の.gsサーバー側のコードは表示されません。ビューメニューの「Execution Transcript」をコードが実行され、印刷の下部が見えます。失敗した行番号はありますか? –