案例:JavaScript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<body>
3
4
<script type="text/javascript">
5
6
function Car() {
7
}
8
9
Car.prototype.color = "blue";
10
Car.prototype.doors = 4;
11
Car.prototype.mpg = 25;
12
Car.prototype.drivers = new Array("Mike","John");
13
Car.prototype.showColor = function() {
14
  document.write(this.color);
15
};
16
17
var oCar1 = new Car();
18
var oCar2 = new Car();
19
20
oCar1.drivers.push("Bill");
21
22
document.write(oCar1.drivers);
23
document.write("<br />")
24
document.write(oCar2.drivers);
25
26
</script>
27
28
</body>
29
</html>
30