First , stay HTML Introduce in the file mootools.js、 mootools-more.js、mootools-core.js, And then you can use mootools Some of the features of encapsulation .

Almost object-oriented .

mootools Use the following form to build objects :

 var Cat = new Class(
{
initialize: function(name) // Be similar to Java Constructor for
{
this.name = name;
}
});

Inherit in the following form :

var littleCat = Cat.extend(
{
initialize:function(name,age)
{
this.parent(name); // Calling the initialize Method
this.age = age;
}
});

Object instantiation and use :

var mycat = new Cat('kity'); // Notice there's another one new There is 
alert(mycat.name); var littlecat = new littleCat('litterkity','ten');
alert(littlecat.name + ' is ' + littlecat.age + ' days old');

var Cat = new Class(
  {
       initialize: function(name)
       {
             this.name = name;
       }
  });
 
  var littleCat = Cat.extend(
  {
       initialize:function(name,age)
       {
              this.parent(name);
              this.age = age;
       }
  });
 
    var mycat = new Cat('kity');
    alert(mycat.name);
    
    var littlecat = new littleCat('litterkity','ten');
    alert(littlecat.name + ' is ' + littlecat.age + ' days old');

js stay mootools Under the framework of new Class More articles about

  1. PhoneGap perhaps Cordova Under the framework Html5 in JS call Android Native code

    PhoneGap perhaps Cordova Under the framework Html5 in JS call Android Native code Check the news > Look at the engine > Open source products 0 People collect this article , Published in 8 Hours before (2013-09-06 00:39) ...

  2. Vue Under the framework of node.js Installation tutorial

    Vue Under the framework of node.js Installation tutorial python The server .php  ->aphche.java ->tomcat.   iis --> It is one that can run JAVASCRIPTR The running ring of ...

  3. CI Within the framework of CSS and JS The path problem of

    Be careful :CI Under the framework of CSS and JS References to must be placed outside the framework , such as , Can establish resource Folders and application At the same level , To encapsulate CSS and JS. stay view Layering resource Inside CSS and JS The following can be used ...

  4. stay Iframe How to jump to the login interface under the framework

    stay Iframe If you jump to the login interface under the framework, you will always jump to the sub interface , Similar to the following picture The trial Respon.Redirect() no way , use Js function , But my jump codes are all written in cs In the document , use Respose.write(),js Function root ...

  5. js Call the parent frame function

    if (window.parent && window.parent.frames["frame_main"]) { alert(window.parent.fra ...

  6. springmvc Within the framework of ajax Request to transfer parameters to solve Chinese garbled code

    springmvc Within the framework of jsp Interface by ajax Request background data , Pass Chinese parameters to the background to display garbled code resolvent :js Code Application encodeURI Deal with it twice /* * Mask processing */ function maskWord( ...

  7. ( turn )springMVC Within the framework of JQuery Pass and parse Json data

    springMVC Within the framework of JQuery Pass and parse Json data json As a lightweight data exchange format , It plays a very important role in the data exchange between the front and the back .Json The grammar of is very simple , The key value pair representation is used .JSON Sure ...

  8. stay Spring Boot Use... Under the frame WebSocket Realize chat function

    In the last blog, we talked about Spring Boot Use... Under the frame WebSocket Implement message push , Message push is one to many , The server sends messages to all browsers , This time we'll see how to use WebSocket Realize one-to-one message sending , model ...

  9. stay Spring Boot Use... Under the frame WebSocket Implement message push

    Spring Boot Learning is ongoing . In the first two blogs, we introduced how to use Spring Boot Container construction Web project ( Use Spring Boot Development Web project ) And how to do it for our Project add to HTTPS Of ...

Random recommendation

  1. High performance Windows Socket Components HP-Socket v3.0.2 Official release

    HP-Socket It's a universal set of high performance Windows Socket The component package , Contains server-side components (IOCP Model ) And client components (Event Select Model ), Widely used in Windows Platform TCP ...

  2. AngularJs Angular Data type judgment

    angular.isArray Determine whether the value in brackets is an array . Format :angular.isArray(value); value: Is determined to be the value of an array . ------------------------ ...

  3. spring mvc To realize the login + abnormal

    The login page login.jsp stay webroot Next <body> <form action="user/login" method="post"&g ...

  4. Daily learning experience :CustomValidator Validation control validates the length of characters entered by the user 、Linq Multi field grouping statistics 、ASP.NET Pop up in the background confirm Dialog box , Then click OK , Execute a piece of code

    2013-9-15 1.    CustomValidator Validation control validates the length of characters entered by the user In the actual development, we usually encounter the problem of verifying the character length of user input , usually , You can write a js The script or function of , stay ASP ...

  5. AndroidRichText Give Way Textview Easy support for rich text ( Images ImageSpan、 Click effects and so on QQ WeChat chat )

    Code address :https://github.com/Luction/AndroidRichText AndroidRichText Help achieve things like QQ, Wechat is the same , One TextView There are words, expressions and pictures in it ...

  6. C# Thread synchronization summary

    Simple operation for integer data type , It can be used Interlocked Class to achieve thread synchronization . For complex thread synchronization , There are several ways : 1.lock keyword : 2.Monitor: 3. Synchronize events and wait handles : 4.Mute ...

  7. php Medium JSON Chinese processing

    Recently PHP I want to output JSON, I checked it on the Internet , Support for Chinese is not very good , Or we can turn it into utf-8 The coding , Reuse json_encode Generate , The client has to utf-8 Transfer to Chinese . For the web page has been used GB2312 Server for , I don't want to fold like this ...

  8. springMVC usage And a simple one based on springMVC hibernate spring Configuration of

    replace struts 1  web.xml Middle configuration springmvc The central controller <?xml version="1.0" encoding="UTF-8"?> ...

  9. elementary analysis Java Source code ArrayList

    Interview questions are often asked LinkedList And ArrayList The difference between , Instead of reciting the crap on the Internet , It's better to download the source code directly ! The source code of this article comes from JRE1.8,java.util.ArrayList Since it's an analysis , It mainly aims at the data structure ...

  10. MongoDB Data backup and recovery

    One : Data backup operation step : 1. Open as administrator cmd, Then open it to mongdb Of bin Folder 2. Enter the command mongodump -h dbhost -d dbname -o dbdirectory -h ...