表单提交
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title> </title> <script type="text/javascript"> window.onload = function(){ var oBtn = document.getElementById('jsSub'); oBtn.onclick = function(){ var form = new FormData(document.getElementById('fs')); console.log(form.get('account')); // null 没取到表单里的值 form.append('amount','10'); console.log(form.get('amount')); // 10 append值成功 } } </script> </head> <body> <p>FormData测试</p><br/> <from id="fs" > <input type="text" name="account" /> <input type="submit" value="提交" id="jsSub" /> </from> </body>