《Ui》.showDialog(《GUI部品》);
《Ui》.showSidebar(《GUI部品》);
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
※Google Apps Script側のスクリプト function showDlog(){ var html = HtmlService.createHtmlOutputFromFile("sample.html") .setTitle("Sample HTML") .setWidth(400) .setHeight(400); DocumentApp.getUi().showDialog(html); } function processForm(form){ Logger.log(form); var str = form.text1 return "あなたは、" + str + "と送信しました。"; } ※「sample.html」ファイルの内容 <html> <head> <script> function onClickBtn(){ google.script.run.withSuccessHandler(onSuccess) .processForm(document.querySelector('#form1')); } function onSuccess(res){ var msg = document.querySelector("#msg"); msg.textContent = res; } </script> </head> <body> <h1>sample dialog</h1> <p id="msg">何か送信して。</p> <form id='form1' onsubmit="javascript:return false;"> <input type='text' name='text1'> <input type='button' value='click' onclick='onClickBtn();'> </form> </body> </html>
<< 前へ |