我继续按下提交按钮时出现白屏。我尝试了很多技巧,只能获得白屏。关于可能出错的任何想法?
Html文件:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
function handleFormSubmit(formObject) {
google.script.run.withSuccessHandler(updateUrl).processForm(formObject);
}
function onFailure(error) {
var div = document.getElementById('output');
div.innerHTML = "ERROR: " + error.message;
}
</script>
</head>
<body>
Hello, World!
<form id="myForm" onsubmit="handleFormSubmit(this)">
<input type="text" name="search">
<input type="submit" value="Submit" />
</form>
<input type="button" value="Close"
onclick="google.script.host.close()" />
</body>
</html>
&#13;
Code.gs:
function processForm(formObject) {
Logger.log('Form was submitted!');
var missVar = 999;
var html = HtmlService.createTemplateFromFile('missingVar');
html.missingVar = missVar;
var htmlOutput = html.evaluate();
}
&#13;
missingvar.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
hello!!
<?= missingVar ?>
</body>
</html>
&#13;