Google表格html不会调用脚本功能 [英] Google sheet html not calling script function
本文介绍了Google表格html不会调用脚本功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的谷歌应用程序中有以下的html代码。 IT应该调用下面的函数,但我什么都没有。直到现在,我在整个代码中使用了相同的脚本
I have the following html code in my google app. IT should call the function below but I'm getting nothing. I've used the same script throughout my code until now
<div id= "right_column">
<p>
<input type="button" value="Enter Grades for Selected Lessons"
onclick="google.script.run.withSuccessHandler(showMsgForLoginAttempt).generate_grades_for_lesson(this.parentNode)"/>
</p>
</div>
以下是函数代码
Here is the code for the function
function generate_grades_for_lesson(formObject) {
msgBox("Hello");
}
任何帮助表示赞赏
Any help is appreciated
推荐答案
在form元素周围使用form而不是p。
使用type =text作为值
Use form instead of p around the form elements. Use type="text" for value
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<div id= "right_column">
<form>
<input type="text" name="grades" placeholder="Grades...">
<input type="button" value="Enter Grades for Selected Lessons"
onclick="google.script.run.withSuccessHandler(showMsgForLoginAttempt).generate_grades_for_lesson(this.parentNode)"/>
</form>
</div>
</body>
</html>
<script>
function showMsgForLoginAttempt() {
console.log("success");
}
</script>
在google apps脚本中使用Browser.msgbox
Use Browser.msgbox in google apps script
function generate_grades_for_lesson(formObject) {
Browser.msgBox("Grades: " + formObject.grades);
}
这篇关于Google表格html不会调用脚本功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文