function boxType(){
this.run=function(){
return true;
}
}
var _hjbglxx=function(){};
_hjbglxx.prototype=new boxType();
_hjbglxx.prototype.bglxBox=function(ele){
//opr code
}
_hjbglxx.prototype.run=function(){
alert(2);
return true;
}
var hjbglxx=new _hjbglxx();我要hjbglxx变量继承boxType中的一个run方法,如果hjbglxx中有run,就覆盖.
现在这功能是实现了,很起来很复杂,
因为我要页面加载后这变量就能直接调用的,所以还很不情愿的加了这一段
var hjbglxx=new _hjbglxx();
this.run=function(){
return true;
}
}
var _hjbglxx=function(){};
_hjbglxx.prototype=new boxType();
_hjbglxx.prototype.bglxBox=function(ele){
//opr code
}
_hjbglxx.prototype.run=function(){
alert(2);
return true;
}
var hjbglxx=new _hjbglxx();我要hjbglxx变量继承boxType中的一个run方法,如果hjbglxx中有run,就覆盖.
现在这功能是实现了,很起来很复杂,
因为我要页面加载后这变量就能直接调用的,所以还很不情愿的加了这一段
var hjbglxx=new _hjbglxx();
解决方案 »
- html中两个p标签之间如何做到不换行~~~~~~~~~~~~~~~~~~~~~标题这么长可以看到了吧~~~~~~~~~~~
- Ext form提交时报错,各种方式都试了还不行
- 导航栏的这种效果怎么实现
- 如何使用onload(20分)
- javascript如何得到文件的绝对路径?(在线等,急)
- 如何获取当前窗口 title 的值并将其显示出来?
- 开新窗口的问题
- 送分題,IE6的怪毛病
- 正则表达式这个怎么写
- node.js var router = express.Router(); TypeError: express.Router is not a functi
- 40分求Js板块以前一个帖子地址
- dwr回调函数执行不下去
因为我有可能 会出现 _hjbglxx2,_hjbglxx3,boxType.run函数是通用的..现在我改成这样的了,不知道 谁还有更好些的方法呢..function boxType(){
this.run=function(){
return true;
}
}function addBGLX(fn){//添加报告类型
fn.prototype=new boxType();
return new fn();
}var hjbglxx=addBGLX(function(){//报告类型 为会计报告类参数
this.run=function(kjField,kjValue){//会计报告类参数 赋值.验证
//opr code
return true;
}
});
//对象构造器,可以摒弃传统的new操作符来生成对象,也更好的诠释了js的基于原型的特点
Object.beget=function(o){
var F=function (){};
F.prototype=o;
return new F();
}var hjbglxx=Object.beget(new boxType());
hjbglxx.bglxBox=function(){};
hjbglxx.run=function(){};
this.run = function(){
return true;
}
}
var _hjbglxx = function(){
this.bglxBox = function(ele){
//Todo...
}
};
_hjbglxx.prototype = new boxType();
_hjbglxx.constructor = boxType;
var test = new _hjbglxx();
alert(test.run());
this.run = function(){
return true;
}
}
function _hjbglxx(){
this.bglxBox = function(ele){
//Todo...
}
};
_hjbglxx.prototype = new boxType();
_hjbglxx.prototype.constructor = _hjbglxx;
var test = new _hjbglxx();
alert(test.run());