我有 google app 脚本应用程序,文件 script.html 使用下面的函数包含在 index.html 中,并且工作正常。但是,script.html有script标签,这会阻止搜索函数定义,我想将script.html包含在index.html中,而不在script.html文件中包含script标签。
包含功能:
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename).getContent();
}
只需将脚本选项卡放入 html 页面即可。
HTML_测试
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<input id="test" type="button" value="Click Me" onclick="testOnClick()">
<script>
<?!= include("JS_Test"); ?>
</script>
</body>
</html>
JS_测试
function testOnClick() {
alert("Hello");
}