<script type="text/javascript"> function Card(name, address, phone) { this.name = name; //初始化名片信息 this.address = address; this.phone = phone; this.PRintCard = function() { //创建printCard函数的定义 line1 = "Name:" + this.name + "<br>/n"; //输出名片信息 line2 = "Address:" + this.address + "<br>/n"; //读取地址 line3 = "Phone:" + this.phone + "<br>/n"; //读取电话信息 document.writeln(line1, line2, line3); //输出 } } Tom = new Card("Tom", "hangzhouRoad 123", "0571-12345"); //创建Tom的名片 Tom.printCard(); //输出名片信息 </script>
新闻热点
疑难解答