Jing-Z

jQuery基础


(function () {
            $("#btn").click(function () {
                if($(this).val()=="关灯"){
                    $("body").css("backgroundColor","black");
//为什么$(this),应该是将this转换成dom对象 $(
this).val("开灯"); } else if($(this).val()=="开灯"){ $("body").css("backgroundColor","white"); $(this).val("关灯"); } }) })

 

posted on 2019-05-25 15:20  Jing-Z  阅读(127)  评论(0)    收藏  举报

导航