<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 / / EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> demo4 </ title>
</ head>
<body>
<script type="text/javascript">
var apple = function (name, color) (
this.color = color;
this.name = name;
)
apple.prototype.showColor = function () (
alert ( "I'm" + this.name + ", my color is:" + this.color);
)
var orange = function (name, color) (
this.color = color;
this.name = name;;
)
orange.prototype = new apple (this.color, this.name);
var s = new apple ( "apple", "green");
s.showColor ();
var b = new orange ( "orange", "orange");
b.showColor ();
alert (s.showColor == b.showColor);
</ script>
</ body>
</ html>







