码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript_5

时间:2017-03-22 16:25:12      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:nbsp   set   mil   调用   first   pre   har   type   数字   

1. JavaScrip中所有事物都是对象:字符串、数字、日期、等等

2. 在javaScripe中,对象是拥有属性和方法的数据

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
</head>
<body>

    <script>
        var message = "Hello World!";
        document.write(message.toUpperCase()+"</br>");//调用对象的方法
        
        //申明对象
        var person1 = new Object();
        person1.firstname = "yoyo";
        person1.lastname = "Xiao";
        person1.age = 33;
        person1.eyecolor = "black";

        var person2 = { firstname: "dodo", lastname: "He", age: 45, eyecolor: "blue" };

        document.write(person1.firstname + " " + person1.lastname + " is " + person1.age + " eyes are " + person1.eyecolor);
        document.write(person2.firstname + " " + person2.lastname + " is " + person2.age + " eyes are " + person2.eyecolor);
    </script>

</body>
</html>

 

JavaScript_5

标签:nbsp   set   mil   调用   first   pre   har   type   数字   

原文地址:http://www.cnblogs.com/xiao9426926/p/6600260.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!