HTML学习1-Dom之事件绑定

事件:

1、注册事件

     a. <div onxxxx=””></div> 

     b. document  .onxxxx= function()  //找到这个标签

2、this,触发当前事件的标签

3、event ,触发当前标签的事件内容

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div onmouseover="Func(this)" onmouseout="Func1(this)"> 123</div>
    <input type="text"  onkeydown="Down(this,event);">
    <script>
        function  Down(ths,e) {
            console.log(e.keyCode);
            
        }
        function Func(ths) {
                ths.style.color = 'red';
        }

        function Func1(ths) {
            ths.style.color = 'black';

        }
        function 
    </script>

</body>
</html>
原文地址:https://www.cnblogs.com/able7/p/8780944.html