Basically achieve JavaScript OOP

xiaoxiao2021-03-06  58

[Sharing] Basically achieve JavaScript OOP // framework.js code as follows: // Author: Wan Changhua // Version: 2003.120401 // Environmental Variable Initialization IF (TypeOf ($ JS_HOME) == "undefined") $ js_home = " / common / jslib / "; // Define JS Home Pathif (TypeOf ($ JS_RUNMODE) ==" undefined ") $ js_runmode =" run "; // Define Run Mode (Run | Debug) // Definition Implement OOP related method Function.Prototype._extends = function (jsclass) {// get classname var _s = this.tostring (). Replace ("function", ""); _s = _s.substring (0, _s.indexof (") ) .Repece (/ / g, "); if (TypeOf (jsclass) ==" string ") {var cls = jsclass.forname (jsclass); if (cls! = null) jsclass = cls;} if (Typeof (jsclass)! = "function") {_ throw (new error (1002, "framework / _extends:" _ "inherited exception {" JSClass "Not legal class}");} var _p = this.prototype = new Jsclass (); // prototype inherits this._base = jsclass; this._super = jsclass.prototype; _p.classname = _s; return _p; // Return prototype}; function.prototype._implements = function (jsclass) {}; // Interface function.prototype.classname = "object"; // system function function _typeof (name) {var _type = false; evAl ('_ type = typeof (' name ')'); return (_type);} function _defined (cname) {var cs = cname.split (".") VAR PN = NULL; for (var i = 0; I

VAR PN = NULL; for (var i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-119489.html

New Post(0)