第一个js事件

Original 2019-04-12 16:26:01 216
abstract:<!DOCTYPE html> <html>     <head>         <meta charset="utf-8">      &
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            input , button{width: 200px; height: 40px; margin: 5px 0px; line-height: 40px; padding: 0px 5px;box-sizing: border-box;}
            input{ border: 1px solid #ddd;}
            button{ border: 1px solid #ffa200; background: #ffa200; color: #fff; text-align: center; }
        </style>
    </head>
    <body>
        <input type="text" value="张三"  readonly="readonly" style="background: #ddd;" onclick="tk(this)" ><br>
        
        <input type="text"  placeholder="请输入联系电话" onfocus="dj(this)" onblur="djBg(this)"><br>
        
        <button onmouseover="hg(this)" onmouseout="hc(this)">确认</button>
        
        
        <script type="text/javascript">
            function tk(tk){
                alert("姓名不可以修改")
            }
            function dj(dj){
            dj.style.background="#eee"
            }
            function djBg(djBg){
                djBg.style.background="#fff"
            }
            function hg(hg){
                hg.style.color="#ff6200"
            }
            function hc(hc){
                hc.style.color="#fff"
            }
        </script>
    </body>
</html>


Correcting teacher:天蓬老师Correction time:2019-04-12 17:06:45
Teacher's summary:function djBg, 这样的函数名, 不是太友好, 不能做到望文生义,这时, 添加一个有意义的注释, 是个好办法

Release Notes

Popular Entries