jQuery面向对象定制业务框架开发
2011-12-23 11:05
323 查看
jbase.js 业务框架基类
/**
* @class: Jbase
* @description: 定制框架基类
* @author: fangxianghua
*/
var Jbase = function() {
this.namespace = "Jbase";//命名空间
this.version = "2.0.0"; //版本
this.parent = null;
this.className = "Jbase";
};
/**
* @function: extend
* @description: 父子类继承函数
* @author: fangxianghua
*/
Jbase.extend = function (subClass, superClass) {
var F = function () { };
F.prototype = superClass.prototype;
subClass.prototype = new F();
subClass.prototype.constructor = subClass;
subClass.parent = superClass.prototype;
if (superClass.prototype.constructor == Object.prototype.constructor) {
superClass.prototype.constructor = superClass;
}
};
//-------------------------常用工具函数定义在基类begin-----------------------------//
//工具函数开发原则:jquery类库中已有的尽量使用其的,否则在此定制相关工具函数
/**
* @function: getKeyCode
* @description: 获取事件转换码
* @author: fangxianghua
* @param: event
* @return: keyCode
*/
Jbase.getKeyCode = function (event) {
event = (event) ? event : ((window.event) ? window.event : "");
return event.keyCode ? event.keyCode : event.which;
};
Jbase.showKeyCode = function (event) {
return event;
};
//-------------------------常用工具函数定义在基类end-----------------------------//
keyboard.js 基于定制框架基类的业务子类
/**
* @class: Keyboard
* @description: 测试框架类
* @author: fangxianghua
*/
Jbase.Keyboard = function () {
//------------全局变量----------
this.className = "Jbase.Keyboard";
this.stylePath = "../style/default/";
this.name = "";
//------------全局变量----------
};
Jbase.extend(Jbase.Keyboard, Jbase);
/**
* @function: Init
* @description: 初始化
* @author: fangxianghua
* @param: null
* @return: null
*/
Jbase.Keyboard.prototype.init = function () {
this.className = "石英,没来!";
this.name = "石英";
};
/**
* @function: showKeyboard
* @description: 显示
* @author: fangxianghua
* @param: null
* @return: null
*/
Jbase.Keyboard.prototype.showKeyboard = function () {
var aa = Jbase.showKeyCode("石英");
alert(aa);
};
var jbaseKeyboard;
if (jbaseKeyboard == null) {
jbaseKeyboard = new Jbase.Keyboard();
}
jQuery.extend(jbaseKeyboard); //为了统一使用jQuery框架将定制业务类追加至jQuery静态构造函数中
jQuery_oop.html 调用页面
<html>
<head>
<title>软键盘</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="page-view-size" content="1280*720" />
<link id="settingcss" rel="stylesheet" type="text/css" href="style/default/setting.css" />
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="js/jbase.js"></script>
<script type="text/javascript" src="js/keyboard.js"></script>
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery.showKeyboard();
});
</script>
</head>
<body style="background-color: #ffffff;">
<div id="main" class="main">
</div>
</body>
</html>
/**
* @class: Jbase
* @description: 定制框架基类
* @author: fangxianghua
*/
var Jbase = function() {
this.namespace = "Jbase";//命名空间
this.version = "2.0.0"; //版本
this.parent = null;
this.className = "Jbase";
};
/**
* @function: extend
* @description: 父子类继承函数
* @author: fangxianghua
*/
Jbase.extend = function (subClass, superClass) {
var F = function () { };
F.prototype = superClass.prototype;
subClass.prototype = new F();
subClass.prototype.constructor = subClass;
subClass.parent = superClass.prototype;
if (superClass.prototype.constructor == Object.prototype.constructor) {
superClass.prototype.constructor = superClass;
}
};
//-------------------------常用工具函数定义在基类begin-----------------------------//
//工具函数开发原则:jquery类库中已有的尽量使用其的,否则在此定制相关工具函数
/**
* @function: getKeyCode
* @description: 获取事件转换码
* @author: fangxianghua
* @param: event
* @return: keyCode
*/
Jbase.getKeyCode = function (event) {
event = (event) ? event : ((window.event) ? window.event : "");
return event.keyCode ? event.keyCode : event.which;
};
Jbase.showKeyCode = function (event) {
return event;
};
//-------------------------常用工具函数定义在基类end-----------------------------//
keyboard.js 基于定制框架基类的业务子类
/**
* @class: Keyboard
* @description: 测试框架类
* @author: fangxianghua
*/
Jbase.Keyboard = function () {
//------------全局变量----------
this.className = "Jbase.Keyboard";
this.stylePath = "../style/default/";
this.name = "";
//------------全局变量----------
};
Jbase.extend(Jbase.Keyboard, Jbase);
/**
* @function: Init
* @description: 初始化
* @author: fangxianghua
* @param: null
* @return: null
*/
Jbase.Keyboard.prototype.init = function () {
this.className = "石英,没来!";
this.name = "石英";
};
/**
* @function: showKeyboard
* @description: 显示
* @author: fangxianghua
* @param: null
* @return: null
*/
Jbase.Keyboard.prototype.showKeyboard = function () {
var aa = Jbase.showKeyCode("石英");
alert(aa);
};
var jbaseKeyboard;
if (jbaseKeyboard == null) {
jbaseKeyboard = new Jbase.Keyboard();
}
jQuery.extend(jbaseKeyboard); //为了统一使用jQuery框架将定制业务类追加至jQuery静态构造函数中
jQuery_oop.html 调用页面
<html>
<head>
<title>软键盘</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="page-view-size" content="1280*720" />
<link id="settingcss" rel="stylesheet" type="text/css" href="style/default/setting.css" />
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="js/jbase.js"></script>
<script type="text/javascript" src="js/keyboard.js"></script>
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery.showKeyboard();
});
</script>
</head>
<body style="background-color: #ffffff;">
<div id="main" class="main">
</div>
</body>
</html>
相关文章推荐
- 《BREW进阶与精通――3G移动增值业务的运营、定制与开发》连载之5---移动增值服务走进生活
- 《BREW进阶与精通――3G移动增值业务的运营、定制与开发》连载之53---BREW SDK 九大功能之电信服务
- 《BREW进阶与精通――3G移动增值业务的运营、定制与开发》连载之75---BREW 中的WEB代理
- 《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之83——BREW后台应用
- [JavaScript]使用jQuery定制开发自己的UI
- 使用Jquery+EasyUI 进行框架项目开发案例讲解之二---用户管理源码分享
- 《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之90——BREW中的调试信息
- 使用Jquery+EasyUI进行框架项目开发案例解说之中的一个---员工管理源代码分享
- 《BREW进阶与精通――3G移动增值业务的运营、定制与开发》连载之13---BREW精要之COM 模型
- 《BREW进阶与精通――3G移动增值业务的运营、定制与开发》连载之33---WAP 调用BREW
- [Socket]基于C++的纯面向对象的通用高性能大并发TCP-SERVER/CLIENT开发框架
- [原创].NET 业务框架开发实战之九 Mapping属性原理和验证规则的实现策略
- 没头没尾--项目开发笔记:面向业务的用户界面与面向对象的数据库如何连接
- 信息管理系统开发平台之业务定制平台介绍(一)
- ASP.NET MVC5 网站开发实践(一) - 框架(续) 模型、数据存储、业务逻辑
- 使用Jquery+EasyUI进行框架项目开发案例解说之中的一个---员工管理源代码分享
- 基于jq, jquery.easie.js 开发面向对象通栏焦点图组件
- 使用Jquery+EasyUI进行框架项目开发案例讲解之一---员工管理源码分享
- JQuery Uploadify v3.2.1 上传图片并预览(基于spring mvc框架开发)
- [原创].NET 业务框架开发实战之七 业务层初步构想