12行目のthisはxhrオブジェクトを指しているのでしょうか。
よろしくお願い致します。
「HTML5 プロフェッショナル認定試験レベル2 スピードマスター問題集 P227 問6-11」より。
<form id="fm" method="POST"> <input type="file" name="file"> </form> <button>send file</button> <script> window.onload = function() { document.querySelector("button") .addEventListener("click", function() { var xhr = new XMLHttpRequest(); var form = new FormData(document.getElementById("fm")); xhr.addEventListener("load", function() { console.log(this.response); }); xhr.open("post", "/upload"); xhr.send(form); }); }; </script>
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/10/27 05:56