5-41.html

来自「《深入浅出Ajax》 源代码」· HTML 代码 · 共 37 行

HTML
37
字号
<HTML>
<HEAD>
<TITLE> AJAX深入浅出--代码5-41</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
<script language="javascript">
function JsFruit() {
	this.name="fruit";
	this.original="not know";
	this.showInfor=function() {
		document.write("this fruit's name is "+this.name+";this fruit's original is "+this.original+"!<br>");
	}
}
function JsApple() {
    var apple = new JsFruit();
	apple.name="apple";
	apple.original="china";
	apple.color="red";
	apple.weight=300;                  
	apple.showInfor=function() {
		document.write("this apple's color is "+this.color+";this apple's weight is "+this.weight+"g!<br>");
	}
	return apple;
}
	var fruit = new JsFruit();
	fruit.showInfor();
	var apple = new JsApple();
	apple.showInfor();
	fruit=apple;
	fruit.showInfor();
	/*
	apple = fruit;
	apple.showInfor();
	*/
</script>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?