<form>
<input type="text">
<button type="reset">重置</button>
<button type="submit">提交</button>
</form>
<script>
var inputEl = document.querySelector('input')
inputEl.oninput = function () {
console.log("oninput")
}
inputEl.onchange = function () {
console.log('onchange')
}
inputEl.onfocus = function () {
console.log('onfucs')
}
inputEl.onblur = function () {
console.log('onblur')
}
var formEl = document.querySelector('form')
formEl.onreset = function (e) {
console.log('点击了重置')
e.preventDefault();
}
formEl.onsubmit = function (e) {
console.log('点击了提交')
e.preventDefault();
}
</script>
打开App,阅读手记