简体   繁体   English

如何从另一个网站导入功能

[英]How to import functions from another website

How to import functions from another website? 如何从另一个网站导入功能? I tried <script src="https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec"></script> but it said: VM13915 userCodeAppPanel?lu=0:1 Uncaught ReferenceError: getUser is not defined. 我尝试了<script src="https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec"></script>但它说:VM13915 userCodeAppPanel?lu = 0:1未定义ReferenceError:getUser未定义。 The link to the website I am trying to get a function from is https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec . 我要从中获取功能的网站的链接是https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec Any ideas? 有任何想法吗? Thanks in advance. 提前致谢。

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <link rel="import" href="https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec">
    <script>
      function sendComments() {
        var YonaEmail = "yona.klatchko@gmail.com";
        var Subject = "Comments";
        var Message = document.getElementById('Comments').value;
        google.script.run.send(YonaEmail, Subject, Message);
      }
    </script>
    <script src="https://ws.sharethis.com/button/buttons.js"></script>
    <script>
      stLight.options({publisher: "a788dcd1-6dfb-49ee-ba6c-3b6822d69fd8", doNotHash: false, doNotCopy: false, hashAddressBar: false});
    </script>
  </head>
  <body>
    <style>
      .myButton {
        -moz-box-shadow:inset 0px 39px 0px -24px #e67a73;
        -webkit-box-shadow:inset 0px 39px 0px -24px #e67a73;
        box-shadow:inset 0px 39px 0px -24px #e67a73;
        background-color:#e4685d;
        -moz-border-radius:4px;
        -webkit-border-radius:4px;
        border-radius:4px;
        border:1px solid #ffffff;
        display:inline-block;
        cursor:pointer;
        color:#ffffff;
        font-family:Arial;
        font-size:15px;
        padding:6px 15px;
        text-decoration:none;
        text-shadow:0px 1px 0px #b23e35;
      }
        .myButton:hover {
        background-color:#eb675e;
      }
        .myButton:active {
        position:relative;
        top:1px;
      }
    </style>
    <font face="Verdana" size="10">
      Welcome!
    </font>
    <br/>
    <br/>
    <font face="Verdana">
      <script src="https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec">
      </script>
      See who you are logged in as: click the button
      <button onclick="getUser()" class="myButton">
        Button
      </button>
    </font>
    <br/>
    <font face="Verdana">
    <a href='https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec'>
      Sign Out
    </a>
    <br/>
    <br/>
    <a href='https://script.google.com/macros/s/AKfycby5vqoQmlIdwJpIaTbfhSIo1d2RlYtWiaGT1yZj1hjJmAcbuo0o/exec'>
      Click here
    </a> to reload the page.
    <br/>
    <a href="https://script.google.com/macros/s/AKfycbwvy4D0EViG-h9ZlKoMaFS-oVWgcKyWFNy5QlwGZydmdV3X3PY/exec">
      Click here
    </a> to go to a 3d Canvas Drawing program I coded.
    <br/>
    <a href='https://www.yahoo.com/'>
      Click here
    </a> to go to Yahoo.com.
    <br/>
    <a href='http://www.theuselessweb.com/'>
      Click here
    </a> to go to the Useless Web.
    <br/>
    <a href='https://www.google.com/'>
      Click here
    </a> to go to Google.com.
    <br/>
    <a href='about:blank'>
      Click here
    </a> to go to a blank page.
    <br/>
    <br/>
    <font face="Verdana">
      Comments? Type them into the textbox and click 'Submit'.
    <br/>
    <textarea id="Comments" rows="6" columns="90">
    </textarea>
    <br/>
    <button class="myButton" onclick="sendComments()">
      Submit
    </button>
    <br/>
    <br/>
    </font>
    <span class='st_facebook_hcount' displayText='Facebook'>
    </span>
    <span class='st_twitter_hcount' displayText='Tweet'>
    </span>
    <span class='st_googleplus_hcount' displayText='Google+'>
    </span>
    </font>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
  </body>
  <footer>
    <font face="Verdana" size="1px">
      Posted by: Yona Klatchko | Contact information:
      <a href="mailto:yona.klatchko@gmail.com">
        yona.klatchko@gmail.com
      </a>
    </font>
  </footer>
</html>

您应该使用发送到Javascript函数。

Instead of making this an application with Google Apps Script, I decided to publish it with google drive. 我决定不使用Google Apps脚本将其用作应用程序,而是决定使用Google Drive发布它。 Then I made a file called 'Script.js' and imported that to the HTML. 然后,我创建了一个名为“ Script.js”的文件,并将其导入到HTML中。 Good to go! 好去!

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

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