当前位置: 首页 > news >正文

企业设计网站公司有哪些工程建设部网站

企业设计网站公司有哪些,工程建设部网站,廊坊网站建设-纵横网络 网站,校园网上超市网站建设战略规划目录 事件之绑定事件处理器 事件之鼠标事件 事件之表单事件 事件之键盘事件 事件之浏览器事件 事件对象 jQuery遍历 事件之绑定事件处理器 1、 .on() 在选定的元素上绑定一个或多个事件处理函数 $(#button).on(click, function(event){console… 目录 事件之绑定事件处理器 事件之鼠标事件 事件之表单事件 事件之键盘事件 事件之浏览器事件 事件对象 jQuery遍历 事件之绑定事件处理器 1、 .on() 在选定的元素上绑定一个或多个事件处理函数 $(#button).on(click, function(event){console.log(事件处理器) }); 事件委托   $(#ul).on(click, li, function(event){console.log($(this).text()); }); 2、.one() 为元素的事件添加处理函数。处理函数在每个元素上每种事件类型 最多执行一次   $(#btn).one(click, function() {console.log(这是一个只能触发一次的事件.); }); 3、.off() 移除一个事件处理函数移除on事件处理器   !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js /script /head bodybutton idbtn1添加事件按钮/buttonbutton idbtn2删除事件按钮/buttonbutton idbtn3按钮/buttonscriptfunction aClick() {console.log(点击事件)}$(#btn1).on(click,function () {$(#btn3).on(click, aClick);});$(#btn2).on(click,function () {$(#btn3).off(click, aClick);});/script /body /html 事件之鼠标事件 1、 .click() 为 JavaScript 的click 事件绑定一个处理器或者触发元素上的 click 事件 $(#btn).click(function() {alert(点击事件); }); 2、.hover() 将二个事件函数绑定到匹配元素上分别当鼠标指针进入和离开元素时被执行   $(li).hover(// 滑入function () {console.log(滑入)},// 滑出function () {console.log(滑出)} );3、.mouseenter() 鼠标进入事件 $(div).mouseenter(function(){console.log(鼠标进入事件); }) 4、.mouseleave() 鼠标离开事件 $(div).mouseleave(function(){console.log(鼠标进入事件); }) 5、.mousemove() 鼠标滑动事件   $(div).mousemove(function(){console.log(鼠标进入事件); }) 6、.mouseover() 鼠标进入事件注支持事件冒泡   !DOCTYPE html html langen head meta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/scriptstyle.container{width: 200px;height: 200px;background-color: red;}.box{width: 100px;height: 100px;background-color: green;}/style /head bodydiv classcontainerdiv classbox/div/divscript$(.container).mouseover(function(){console.log(鼠标进入事件container);})$(.box).mouseover(function(){console.log(鼠标进入事件box);})/script /body /html 7、.mouseout() 鼠标离开事件注支持事件冒泡   !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/scriptstyle.container{width: 200px;height: 200px;background-color: red;}.box{width: 100px;height: 100px;background-color: green;}/style /head bodydiv classcontainerdiv classbox/div/divscript$(.container).mouseout(function(){console.log(鼠标离开事件container);})$(.box).mouseout(function(){console.log(鼠标离开事件box);})/script /body /html 事件之表单事件 1、.focus() 为 JavaScript 的 focus 事件绑定一个获取焦点处理函数或者触发元素上的 focus 事件 $(#input).focus(function() {alert(获得焦点事件); }); 2、.blur() 为 blur 事件绑定一个失去焦点处理函数   $(#other).click(function() {$(#target).blur(); }); 3、.change() 为JavaScript 的 change 事件绑定一个表单改变处理函数   $(.target).change(function() {alert(内容改变); }); 4、.submit() 当用户提交表单时就会在这个表单元素上触发submit事件。它只能绑定在 form 元素上   $(#target).submit(function() {alert(表单提交事件); });事件之键盘事件 1、 .keydown() 添加键盘按下事件 !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js /script /head bodyinput typetext classusernamescript$(.username).keydown(function(){console.log(键盘);})/script /body /html2、.keypress() 添加键盘事件   !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/script /head bodyinput typetext classusernamescript$(.username).keypress(function(){console.log(键盘);})/script /body /html3、.keyup() 添加键盘抬起事件   !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js /script /head bodyinput typetext classusernamescript$(.username).keyup(function(){console.log(键盘);})/script /body /html 事件之浏览器事件 1、.resize() 添加浏览器窗口发生变化触发事件 !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/script /head bodyscript$(window).resize(function(){console.log(改变浏览器尺寸);})/script /body /html2、.scroll() 浏览器滚动事件   !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/script /head bodyscript$(window).scroll(function(){console.log(滚动);})/script /body /html 事件对象 1、event.type 获取事件类型   $(#btn).click(click,function(e){console.log(e.type); }) 2、event.target 获取当前元素对象   $(#btn).click(click,function(e){console.log(e.target); }) 3、event.currentTarget 获取当前元素对象   温馨提示 target指向触发事件元素 currentTarget指向添加事件的元素 !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/scriptstylediv{width: 100px;height: 100px;background-color: red;}/style /head bodydiv idcontainerbutton idbtn按钮/button/divscript$(#container).click(click,function(e){console.log(container,e.currentTarget);console.log(container,e.target);})$(#btn).click(click,function(e){console.log(btn,e.currentTarget);console.log(btn,e.target);})/script /body /html4、event.preventDefault() 如果调用这个方法默认事件行为将不再触发。   a hrefhttps://itxiaotong.comitxiaotong/a script$(a).click(click,function(e){e.preventDefault();}) /script5、event.stopPropagation() 防止事件冒泡到DOM树上也就是不触发的任何前辈元素上的事件处理函数   !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/scriptstylediv{width: 100px;height: 100px;background-color: red;}/style /head bodydivbutton按钮/button/divscript$(div).click(click,function(e){console.log(div);})$(button).click(click,function(e){e.stopPropagation();console.log(button);})/script /body /html jQuery遍历 1、 .map() 通过一个函数匹配当前集合中的每个元素,产生一个包含新的jQuery对象 !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js /script /head bodyulli列表1/lili列表2/lili列表3/lili列表4/li/ulscript$(li).map(function(index,ele){console.log(index,ele);})/script /body /html 2、.each() 遍历一个jQuery对象为每个匹配元素执行一个函数   $(li).each(function(index,ele){console.log(index,ele); }) 温馨提示 each和map的返回值不同map返回一个新的数组each返回原始数组 3、 .get() 通过jQuery对象获取一个对应的DOM元素 !DOCTYPE html html langen headmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/titlescript src./js/jquery-3.6.0.min.js/script /head bodyulli列表1/lili列表2/lili列表3/lili列表4/li/ulscriptvar li $(li).get(0);li.innerHTML 新的列表/script /body /html
http://www.sadfv.cn/news/332160/

相关文章:

  • 西安制作网站公司有个做特价的购物网站
  • 如何能快速搜到新做网站链接wordpress 虚拟下载插件
  • 购物网站源代码怎么做网站后台管理系统
  • 网站产品标题怎么写免费wordpress XIU主题
  • 在线写作网站网页筛选wordpress
  • 茶叶怎么做网站销售贵阳网站建设-中国互联
  • 网站首页description标签wordpress字符图标
  • 目前个人网站做地最好是哪几家wordpress搜索结果页
  • 大型网站建设企业网络营销案例分析与实践
  • 微 网站怎样做网络销售平台
  • 福州绿光网站建设工作室织梦网站搬家教程
  • 网站建设合同服务响应时间上海设计公司招聘
  • 卑鄙的网站开发公司电商网站建设源代码
  • 建设淘宝优惠券网站网站优化方法页面
  • 简洁游戏企业网站关键对话
  • 建设个人网站刷重庆h5建站
  • 网站上线需要多久网站留言系统 提交没反应
  • 微信服务号可以做万网站么广州冼村和猎德村哪个最有钱
  • mvc5 网站开发美學 pdf免费网战空间
  • 网站运营周期营销网站怎样做
  • wordpress换站网站建设素材收集通知
  • 济南外贸建站企业网站推广方法有哪些
  • 化妆品公司网站建设方案wordpress转发得红包
  • 自己做网站挣钱吗网站建设整体流程
  • 佛山新网站制作机构学做漂亮早餐的网站
  • 宁波营销网站建设网架安装
  • 佛山网站搜索排名苏州知名网站建设定制
  • 怎么选择大连网站建设青海西宁最新消息今天
  • 哪个网站可以做卖房如何选择电商网站建设
  • 青海省建设厅网站职称评审表热狗seo外包