繁体   English   中英

Google Sheet HTML不调用脚本功能

[英]Google sheet html not calling script function

我的Google应用程序中包含以下html代码。 IT应该调用下面的函数,但我什么也没得到。 到目前为止,我在整个代码中都使用了相同的脚本

<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>

这是该功能的代码

function generate_grades_for_lesson(formObject) {
    msgBox("Hello");
}

任何帮助表示赞赏

在表单元素周围使用form而不是p。 使用type =“ text”作为值

<!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

function generate_grades_for_lesson(formObject) {
  Browser.msgBox("Grades: " + formObject.grades);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM