您的位置:首页 > Web前端 > JavaScript

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

2016-11-10 17:06 323 查看
<!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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: