有大神解释一下var set什么意思吗?

来源:4-1 编程挑战

穿梭时间

2019-03-26 20:13

 var txt=document.getElementById("txt");

   var set={

    changeColor:function(){

        txt.style.color="red";

        txt.style.backgroundColor="#ccc";

    },

    changeSize:function(){

        txt.style.width="300px";

        txt.style.height="300px";

    },

    objHide:function(){

        txt.style.display="none";

    },

    objShow:function(){

        txt.style.display="block";

    },

    offSet:function(){

        var message=confirm("你确定要重置所有设置么?");

        if(message==true){

            txt.removeAttribute('style');

        }

    }

  }


写回答 关注

1回答

  • weixin_慕尼黑2437450
    2019-03-26 22:08:31

    就是定义一个变量


JavaScript入门篇

JavaScript做为一名Web工程师的必备技术,本教程让您快速入门

738651 学习 · 9561 问题

查看课程

相似问题