var obj = {
instance:"demo",
str:{
text:function(obj)
{
alert(obj.instance);
}
},
fortest:function(){
alert(this.instance);
}
}
obj.str.text(obj);
instance:"demo",
str:{
text:function(obj)
{
alert(obj.instance);
}
},
fortest:function(){
alert(this.instance);
}
}
obj.str.text(obj);
/*<![CDATA[*/
Function.prototype.MakeChain = fMakeChainX;function obj()
{
Function.MakeChain(this);
}
obj.prototype.instance = "demo";
obj.prototype.fortest = function(){ document.write(this.instance, "<br/>");};function str()
{
this.temp = "temp";
}
obj.prototype.str = str;
str.prototype.text = function(){ document.write(this.Parent.instance, "<br/>"); }function fMakeChainX(Obj)
{/* shawl.qiu code, void return */
/* using: fMakeChainX(this); | Function.MakeChain(this); */
for(var i in Obj)
{
if
(
typeof(Obj[i])=="function"
&&
(
/\bthis\.\b/.test(Obj[i])
||
/Function\.MakeChain/.test(Obj[i])
)
)
{
var Count = 0;
for(var j in Obj[i].prototype)
{
Obj[i].prototype.Parent = Obj;
Obj[i] = new Obj[i];
arguments.callee(Obj[i]);
return;
}
if(/this\.\S+\s*\=/.test(Obj[i].toString()))
{
Obj[i].prototype.Parent = Obj;
Obj[i] = new Obj[i];
return;
}
}
}
}/* function fMakeChainX(Obj) */var obj_instance = new obj();
obj_instance.str.text();
/*]]>*/
</script>
<script type="text/javascript">
/*<![CDATA[*/function obj()
{
Function.MakeChain(this);
}
obj.prototype.instance = "demo";
obj.prototype.fortest = function(){ document.write(this.instance, "<br/>");};function str()
{
this.temp = "temp";
}
obj.prototype.str = str;
str.prototype.text = function(){ document.write(this.Parent.instance, "<br/>"); }Function.prototype.MakeChain = fMakeChainX;
function fMakeChainX(Obj)
{/* shawl.qiu code, void return */
/* using: fMakeChainX(this); | Function.MakeChain(this); */
for(var i in Obj)
{
if(typeof(Obj[i])=="function" && (/\bthis\.\b/.test(Obj[i]) || /Function\.MakeChain/.test(Obj[i])))
{
var Count = 0;
for(var j in Obj[i].prototype){Count++; break;}
if(/this\.\S+\s*\=/.test(Obj[i].toString())||Count>0)
{
Obj[i].prototype.Parent = Obj;
Obj[i] = new Obj[i];
arguments.callee(Obj[i]);
return;
}
}
}/* for(var i in Obj) */
}/* function fMakeChainX(Obj) */var obj_instance = new obj();
obj_instance.str.text();/*]]>*/
</script>
function(){
var self=this
this.instance="demo"
this.str={}
this.str.text=function(){
alert(self.instance)
}
}