Javascript 如何将HTML变量传递给google应用程序脚本

Javascript 如何将HTML变量传递给google应用程序脚本,javascript,html,google-apps-script,Javascript,Html,Google Apps Script,我写了一些来获取用户在文本区域中的输入,然后将其传递到google应用程序脚本,并将其发送到我的主google脚本,以通过电子邮件发送。我还试图让他们通过项目的财产没有运气 问题标题 说明 发送 函数myFunction(){ var a=document.getElementById(“sDes”).value; var b=document.getElementById(“lDes”).value; } 试试这个: 填写serverfunctionname和htmlfilename后

我写了一些来获取用户在文本区域中的输入,然后将其传递到google应用程序脚本,并将其发送到我的主google脚本,以通过电子邮件发送。我还试图让他们通过项目的财产没有运气


问题标题



说明

发送

函数myFunction(){ var a=document.getElementById(“sDes”).value; var b=document.getElementById(“lDes”).value; }
试试这个:

  • 填写serverfunctionname和htmlfilename后运行openDialog()函数
  • 您的html:

    <!DOCTYPE html>
    <html>
    
    <head>
      <base target="_top">
    </head>
    
    <body>
      <p style="font-family:verdana;font-size:15px">Problem title</p>
      <input type="text" id="sDes"> <br><br>
      <p style="font-family:verdana;font-size:15px">Decription</p>
      <textarea style="resize: none;" rows="8" cols="63" id="lDes"></textarea>
      <button type="button" onclick="myFunction()">Send</button>
      <p id="demo"></p>
    </body>
    <script>
      function myFunction() {
        var a = document.getElementById("sDes").value;
        var b = document.getElementById("lDes").value;
        google.script.run.serverfunctionname(a,b);//modification
      }
    </script>
    
    </html>
    
    试试这个:

  • 填写serverfunctionname和htmlfilename后运行openDialog()函数
  • 您的html:

    <!DOCTYPE html>
    <html>
    
    <head>
      <base target="_top">
    </head>
    
    <body>
      <p style="font-family:verdana;font-size:15px">Problem title</p>
      <input type="text" id="sDes"> <br><br>
      <p style="font-family:verdana;font-size:15px">Decription</p>
      <textarea style="resize: none;" rows="8" cols="63" id="lDes"></textarea>
      <button type="button" onclick="myFunction()">Send</button>
      <p id="demo"></p>
    </body>
    <script>
      function myFunction() {
        var a = document.getElementById("sDes").value;
        var b = document.getElementById("lDes").value;
        google.script.run.serverfunctionname(a,b);//modification
      }
    </script>
    
    </html>
    

    不幸的是,从你的问题来看,我不确定你的问题。当您的HTML包含在Google Apps脚本项目中时,您可以使用。当您的HTML不包含在GAS项目中时,例如,当它放在本地PC上时,您可以使用。关于这些情况,我认为您可以在Stackoverflow中看到示例脚本。如果这对你的情况没有帮助,我道歉。不幸的是,从你的问题来看,我不确定你的问题。当您的HTML包含在Google Apps脚本项目中时,您可以使用。当您的HTML不包含在GAS项目中时,例如,当它放在本地PC上时,您可以使用。关于这些情况,我认为您可以在Stackoverflow中看到示例脚本。如果这对你的情况没有帮助,我道歉。