您的位置:首页 > Web前端 > JQuery

jquery自定义类方法一例

2015-09-29 16:13 721 查看
/**
*定义:form控件的js类函数
* vp:hsg
* create date:2015-09
*/
//定义js表单对象 FormObject
;(function(){
$.FormObject = function () {
//var e = $('#' + e_name);
//默认属性值
var m_oid = '';
var m_Name = '';
var m_form_width = 800;
var m_form_height = 600;
//属性的获取与设置方法
this.oid = function () {
return m_oid;
};
this.oid_set = function (value) {
m_oid = value;
};
//
this.Name = function () {
return m_Name;
};
this.Name_set = function (value) {
m_Name = value;
};
//
this.form_width = function () {
return m_form_width;
};
this.form_width_set = function (value) {
m_form_width = value;
};
//
this.form_height = function () {
return m_form_height;
};
this.form_height_set = function (value) {
m_form_height = value;
};
//添加方法
this.Msg = function (msg) {
alert(msg);
};
//返回函数本身对象
return this;
};
})(jQuery);

//
var fo = new $.FormObject();
fo.oid_set('oid');
//fo.form_height_set(1000);
//
alert(fo.form_height());
alert(fo.oid());
fo.Msg('good');
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: