(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("关灯"); } }) })