クリックした時に指定したページを開くボタンの例です
下の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の要素がクリックされたら この機能がやること 指定したページを新規タブで開く |