私はスプレッドシート用の簡単なHTMLフォームを用意しています。これを使用すると、データを入力してそのデータをスクリプトに使用できます。今、私は誰かにHTMLファイルへのいくつかのデザイン調整をさせて、何らかの理由でこれ以上は動作しないように見える(ボタンは応答しない/関数を呼び出さない)。最初のバージョンは動作し、2番目のバージョンは動作しません。HTMLフォームが特定のデザインで非応答
- HTMLファイルで何がうまくいかないのかをトラブルシューティングするにはどうすればよいですか。 - あなたは、そのスタイルを制御するために、別の
div
にあなたのボタンを包みますがでてきました:
<!DOCTYPE html> <html> <head> <base target="_top"> </head> <br> <script> function myFunction() { var date = new Date(); document.getElementById('date').placeholder = date.toLocaleDateString(); } </script> <body onload= "myFunction()"> <div align="center"> <form> Project Name <font color=red>*</font>:<br> <input type="text" name="pName"> <br> <br> Project Owner <font color=red>*</font>:<br> <input type="text" name="pOwner"> <br> <br> Sheet Responsible:<br> <input type="text" name="pResp"> <br> <br> Starting Time:<br> <input type="text" name="pDate" id="date"> <br> <br><br> <input type="button" value="Create" onclick="google.script.run .withSuccessHandler(google.script.host.close) .createSheet(this.parentNode)" /> </form> </div> </body> </html> ----------------------------------------------------------------------------------------------------- <!DOCTYPE html> <html> <style> div { margin: auto; width: 40%; font-family: Arial; } div.button { text-align: center; } input[type=text] { width: 100%; } </style> <script> function myFunction() { var date = new Date(); document.getElementById('date').placeholder = date.toLocaleDateString(); } </script> <head> <base target="_top"> </head> <br> <body onload="myFunction()"> <div> <form> Project Name <font color=red>*</font>:<br> <input type="text" name="pName"> <br> <br>Project Owner <font color=red>*</font>:<br> <input type="text" name="pOwner"> <br> <br>Sheet Responsible:<br> <input type="text" name="pResp"> <br> <br>Starting Time:<br> <input type="text" name="pDate" id="date"> <br> <br> <div class="button"> <br> <input type="button" value="Create" onclick="google.script.run .withSuccessHandler(google.script.host.close) .createSheet(this.parentNode)" /> </div> </form> </div> </body> </html>
'.createSheet(this.parentNode.parentNode)'を試してください。もう一つの 'parentNode' –