Apps Script公式リファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2017年12月31日日曜日

ボタンをクリックしたら新規ページを開く

HTML Serviceでこういうボタンを作る





クリックした時に指定したページを開くボタンの例です
下のindex.htmlの
window.open("https://www.google.co.jp/");
で開くページのURLを指定しています



コード.gs
function doGet() {
  return HtmlService.createHtmlOutputFromFile("index");
}
意訳
この機能がやること
指定したHTMLファイルを表示する




index.html
<!DOCTYPE html>
<html>
<body>
  <button id="bt">新規ウィンドを開く</button>
  <script>
    document.getElementById("bt").onclick = bt_clicked;

    function bt_clicked() {
      window.open("https://www.google.co.jp/");
    }
  </script>
</body>
</html>
意訳
これはHTML5文書です


ボタンを置く(idはbt)

idがbtの要素がクリックされたら

この機能がやること
指定したページを新規タブで開く







Latest post

Google Apps Scriptの障害時はIssueTrackerを見てみる - Incidents for Apps Script are reported on Issue Tracker

IssueTracker > Apps Script issues https://issuetracker.google.com/savedsearches/566234 Google Apps Scriptの障害時は IssueTracker に課題が上がっていることが...