如何从其他网站导入功能

时间:2016-06-03 19:13:05

标签: javascript html google-apps-script

如何从其他网站导入功能?我试过<script src="https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec"></script>但它说:VM13915 userCodeAppPanel?lu = 0:1未捕获的ReferenceError:未定义getUser。我试图从中获取功能的网站链接是https://script.google.com/macros/s/AKfycbzsy0OpryGgx9tDA9WxMLqi8A25jny20doVF1g6VwpeiUFFA5Mw/exec。有任何想法吗?提前谢谢。

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

2 个答案:

答案 0 :(得分:0)

您应该使用Send To Javascript功能。

答案 1 :(得分:0)

我决定使用谷歌硬盘发布它,而不是将其作为Google Apps脚本的应用程序。然后我创建了一个名为&#39; Script.js&#39;并将其导入HTML。很高兴!