javascript中使用带有参数的自定义构造函数

来源:互联网 发布:支付宝网络pos机 编辑:程序博客网 时间:2024/06/06 09:35
<!DOCTYPE html><html lang="en"><head>    <meta http-equiv="content-type" content="text/html;charset=UTF-8">    <title>javascript中使用带有参数的自定义构造函数</title>    <script type="text/javascript">        <!--         function  Monitor(price1,factory1,type1,size1) {                   this.price=price1;                     this.factory=factory1;                     this.type=type1;                     this.size=size1;          };          var Monitor1=new Monitor(1800,"元洪公司","A等",18);          document.write("显示器的生产厂家:",Monitor1.factory,"<br/>");        document.write("显示器的型号:",Monitor1.type,"<br/>");        document.write("显示器的尺寸:",Monitor1.size,"<br/>");        document.write("显示器的价格:",Monitor1.price,"<br/>");        -->    </script></head><body></body></html>
0 0