第11次作业-利用构造函数创建对象

这个作业属于哪个课程 https://edu.cnblogs.com/campus/sdscfz/SF3
这个作业要求在哪里 https://edu.cnblogs.com/campus/sdscfz/SF3/homework/12975
这个作业的目标 第11次作业-利用构造函数创建对象

html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        function Stu(name,age,sex,love){
            this.name = name;
            this.age = age;
            this.sex = sex; 
            this.love = love;
           
        }

        var t = new Date()
        document.write(t+'<br>')
        // now.toLocaleDateString() + ' ' +
        // now.toLocaleTimeString();

        var student1 = new Stu('fill','109岁','男','非常喜欢web'+'<br>');
    </script>
    <button ondblclick="document.write(student1.name+'&nbsp'+'&nbsp'+student1.age+'&nbsp'+'&nbsp'+student1.sex+'&nbsp'+'&nbsp'+student1.love+t+'<br>')">按钮<button></button>
</body>
<html>

posted @ 2023-05-16 23:45  filll  阅读(9)  评论(0)    收藏  举报