js-可以使用id直接操作DOM
//一般不建议使用,可以在console调试时使用 <input type="button" id="btn" value="btn"> <input type="button" id="location" value="btn"> <script> btn.onclick=function(){ console.log('hello'); //结果弹出 --hello } location.onclick=function(){ console.log('location'); //无任何输出--因为window自带locaiton属性,此时window的location属性,覆盖了id为location的标签 } </script>