元素
<button class&#61;"btn" name&#61;"nn" id&#61;"btnn">上传图片</button>
原生获取button按钮的方式, ->给按钮注册点击事件
let btn1 &#61; document.querySelector(&#39;.btn&#39;)
let btn2 &#61; document.getElementsByClassName(&#39;btn&#39;)
let btn3 &#61; document.querySelectorAll(&#39;.btnn&#39;)
let btn4 &#61; document.getElementsByName(&#39;nn&#39;)
let btn5 &#61; document.getElementById(&#39;btnn&#39;)
let btn6 &#61; document.getElementsByTagName(&#39;button&#39;)
注册点击事件
btn1.addEventListener(&#39;click&#39;,()&#61;>{console.log(&#39;点击&#39;)})
btn2[0].addEventListener(&#39;click&#39;,()&#61;>{console.log(&#39;点击&#39;)})