json面向对象

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>

</style>

</head>
<body>

<script type="text/javascript">
//不适合多个对象
var json = {
    name: 'lin',
    qq: '23287346',

    showName:function()
    {
        alert('我的名字叫:'+ this.name);
    }
    showQQ:function()
    {
        alert('我的QQ号是:'+ this.qq);
    }
};

json.showName();
json.showQQ();
//Json:整个程序里只有一个对象,写起来比较简单
</script>
</body>
</html>

 

posted @ 2017-01-20 14:35  萤子  阅读(187)  评论(0)    收藏  举报