标签:style class blog code java color
在javascript中写类有多种方式: 1.function()中嵌套function; 2.prototype的方式 ,3.json的方式,如下: <script language="javascript"> var Mouse={ m_name:"Big Mouse", m_age:1, getName:function(){ return Mouse.m_name; }, getAge:function(){ return Mouse.m_age; }, setName:function(str_name){ Mouse.m_name=str_name; } }; var m_name=Mouse.getName(); var alert_=""; alert_+=m_name+" , "; Mouse.setName("Small Mouse"); m_name=Mouse.getName(); alert_+=m_name; alert(alert_); </script>
json 包含字段及函数的写法,布布扣,bubuko.com
标签:style class blog code java color
原文地址:http://www.cnblogs.com/JerryWang24/p/3785740.html