题解 | #点击按钮隐藏元素#

点击按钮隐藏元素

http://www.nowcoder.com/practice/9b0016737b3040aaa61316890f1ac3f8

<!DOCTYPE html>
<html>
    <head>
        <meta charset=utf-8>
        <style type="text/css">
            .box {
                width: 100px;
                height: 100px;
                border: solid 1px black;
                /*补全代码*/
                
            }
            .btn{
                width: 20px;
                height: 20px;
                background-color: red;
                /*补全代码*/
                
            }
        </style>
    </head>
    <body>

        <div class='box'>
            <div class='btn'>X</div>
        </div>

        <script type="text/javascript">
            var btn = document.querySelector('.btn');
            var box = document.querySelector('.box');
            btn.onclick = function(){
                // 补全代码
                
            }
        </script>
    </body>
</html>

全部评论

相关推荐

04-01 16:02
已编辑
武汉工程大学 Java
沉淀小子:不太懂你强调第一次面的意思,感觉没必要强调,有面试就去面,少搞点焦虑
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务