代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="box">
<div class="box-item">
<div class="item-title">点击对象</div>
<input type="text" id="item-input">
</div>
<form action="/" method="get" class="formSubmit" onsubmit="return false">
<input type="text" name="username" value="111111">
<input type="text" name="userpass" value="2222222">
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
</div>
<script>
let _box = document.querySelector('.box');
let _boxItem = document.querySelector('.box-item');
let _itemTitle = document.querySelector('.item-title');
let _itemInput = document.querySelector('#item-input');
_box.addEventListener('click', function (event) {
let e = event || window.event;
console.log('点击了box', event);
})
_itemInput.addEventListener('focus', function () {
console.log('当前输入框已被选中')
})
_itemInput.addEventListener('blur', function () {
console.log('当前输入框已离开')
})
_boxItem.addEventListener('click', function () {
console.log('点击了box-item');
})
_itemTitle.addEventListener('click', function (event) {
// event.stopPropagation();
if (window.event) {
window.event.cancelBubble = true
} else {
event.stopPropagation();
}
console.log('点击了item-title');
// return false;
})
window.addEventListener('keyup', function (event) {
console.log(event);
})
let _formSubmit = document.querySelector('.formSubmit');
_formSubmit.addEventListener('submit', function () {
console.log('表单已提交');
return false;
})
_formSubmit.addEventListener('reset', function () {
console.log('表单已重置');
return false;
})
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。