Blogger Information
Blog 18
fans 0
comment 2
visits 10429
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
浏览器中常用的JS操作
go0
Original
580 people have browsed it

鼠标点击事件

  1. <body>
  2. <button onclick="console.log('asdfasdf');">按钮1</button>
  3. <button onclick="setbg(this)">按钮2</button>
  4. <script>
  5. // function setbg(ele) {
  6. // document.body.style.backgroundColor = "wheat";
  7. // ele.style.backgroundColor = "yellow";
  8. // ele.textContent = "保存成功";
  9. // }
  10. </script>
  11. <script src="outer.js"></script>
  12. </body>

获取页面中的元素

  • document.querySelector(css选择器)
  • document.querySelectorAll(css选择器)

    只要css选择器用的好,没有哪个选不了
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:作业写完整
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post