<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <script> function Account(name, cardno,balance) //构造函数 { this.name=name; this.cardno=cardno; this.balance=balance; } Account.prototype.deposit=function (value) //原型 { this.balance +=value; }; Account.prototype.withdraw=function (value) { this.balance -=value; }; Account.prototype.outputinfo=function () { alert(this.name +":"+this.balance); }; var obj=new Account('blue', '258248832',2245700); obj.deposit(2245700); obj.withdraw(20000); obj.outputinfo(); </script> </head> <body> </body> </html>
JS打印账户余额存款.html
最新推荐文章于 2023-03-28 17:44:37 发布