关于JS Object中类、类私有方法、类公有方法、原形方法的问题测试。
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script>
function Passenger()
{
Name = function()
{
alert("zh");
return "adam";
}
this.Person = function()
{
var str = "";
str += Name();
alert(str);
return str;
}
var imgshow = document.getElementById("imgShow");
//alert(imgshow);
imgshow.src = "http://img1.pconline.com.cn/pconline/0707/30/1068776_070731_cool_ip_05.jpg";
imgshow.style.display = "none";
}
function MyClass()
{
this.Name = "Hello";
}
MyClass.prototype.MyFun = function()
{
alert(this.Name);
}
function Animal(name)
{
this.name = name;
alert(this.name);
}
function Dog(name)
{
Animal.call(this, name);
}
Dog.prototype = new Animal();
Dog.prototype.ChangeName = function(newName)
{
this.name = newName;
alert(this.name);
}
</script>
</HEAD>
<BODY>
<img id="imgShow" src="" />
sfdsfdafdsa
<script>
//var passenger = new Passenger();
//passenger.Person();
var animal = new Animal("tony");
var dog = new Animal("Jerry");
var subDog = new Dog("Leny");
subDog.ChangeName("Andy");
</script>
</BODY>
</HTML>