Regardless of whether java, c #, or vb is used to construct a pair. classobj = new classobj () can be used () the method constructs a class, and then uses the attention and method. In fact, javascript can also be implemented.
Example: Create a js file and define an object EmcObj
1> definition structure creation function EmcObj = function (w, h)
{
This. xWidth = w;
This. yHeight = h; // this table class private changes
}
2> defining methods
EmcObj. prototype. _ Init = function ()
{
This. config = {
Render: "AUTO ",
LinkType: "M ",
LinkColor: "blue ",
NodeColor: "# CCCCFF ",
};
// Use this. config. nodeColor to obtain the token value.
} ECOTree. prototype. toString = function (){
Var sl = [];
Sl. push ("<div name = abc> ");
Sl. push ("</div> ");
Return sl. join ('');
}
3> define this. config. name = "aa"; // this will do.
Using Method var emc
Function CreateEmcObj ()
{
Emc = new EmcObj (100,100 );
Document. write (emc. tostring ());
}
Function CreateInit ()
{
Emc. _ init ();
}
OK