Posted on 2007-04-13 17:07
xh_blood 阅读(356)
评论(0) 编辑 收藏 所属分类:
js
<SCRIPT LANGUAGE="JavaScript">
function BaseClass()
{
BaseClass.prototype.HelloWorld = function()
{
alert("hello world from base");
}
BaseClass.prototype.GoodBye = function()
{
alert("good by from Base");
}
}
function ClassA()
{
ClassA.prototype.HelloWorld = function()
{
alert("hello world from ClassA");
}
}
ClassA.prototype = new BaseClass();
function ClassB()
{
alert("ClassB");
ClassB.prototype.HelloWorld = function()
{
alert("hello world from ClassB");
}
}
ClassB.prototype = new BaseClass();
var objB = new ClassB();
objB.HelloWorld();
objB.GoodBye();
var objA = new ClassA();
objA.HelloWorld();
objA.GoodBye();
</script>