如下情况禁用提交按钮: 脚本初始载入时。(change事件会再脚本被改变时查看是否有值,以此启用提交按钮) 表单被提交后。(防止表单被多次提交) HTML <label for="pwd">New password:</label> <input type="password" id="pwd" /> <input type="submit" id="submit" value="submit" /> <script src="js/utilities.js"></script> <script src="js/disable-submit.js"></script> utilities.js // Helper function to add an event listener function addEvent (el, event, callback) { if ('addEventListener' in el) { // If addEventListener works el.addEventListener(event, callback, false); // Use it } else {