Http://www.cnblogs.com/ziyiFly/category/153863.html (2-10)
Mootools framework [2]-core: main method test example
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "_ default" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> mootools-core </title>
<Script language = "JavaScript" type = "text/JavaScript" src = "mootools-1.2-core-jm.js"> </SCRIPT>
<Script language = "JavaScript" type = "text/JavaScript">
{
// 1. Create an object using the following form:
VaR cat = new class ({
Initialize: function (name ){
This. Name = Name;
}
});
// Test the instance
VaR cat = new CAT ('Kitty ');
Alert (Cat. Name );
// Class for inheritance. mootools does this:
VaR animal = new class ({
Initialize: function (name ){
This. Name = Name;
}
});
// Inherit
VaR cat2 = animal. Extend ({
Initialize: function (name, age ){
This. Parent (name); // call animal's initialize method
This. Age = age;
}
});
// Test the instance
VaR excat = new cat2 ('Kitty ', 20 );
Alert (excat. Name + '--' + excat. Age );
// Extension
VaR person = new class ({
Initialize: function (name ){
This. Name = Name;
}
});
Person. Implement ({
Initialize: function (name, age ){
This. Name = Name;
This. Age = age;
},
Myaction: function (){
Alert (this. Name + '--' + this. Age );
}
});
// Test the instance
VaR P = new person ('zarknight ', 24 );
P. myaction ();
// 6. $ pick
VaR x = $ pick ("openfdc", "zarknight"); // openfdc
Alert (X );
Var y = $ pick (null, "zarknight"); // zarknight
Alert (y );
VaR z = $ pick (1, 2); // 1
Alert (z );
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
</Div>
</Form>
</Body>
</Html>