ftiger 2010-06-26 03:11
浏览 227
已采纳

请教,Mootools写一个Class,Extends Element结果不成功

[code="java"]

<!-- form1 =new Class({ Extends : Element ,options:{ } ,initialize:function(j,ops){ log(j); this.setOptions(ops); var frameId = j.frameId; this.parent("div",{"id":frameId}); } }) window.addEvent('domready', function() { var ff = new form1(); $("test").grab(ff); }); //-->



[/code]

firebug 出错提示 document.id(tag) is null
出错行 mootools.js 1431

mootools.js对应部分代码

[code="java"]
var Element = new Native({

name: 'Element',

legacy: window.Element,

initialize: function(tag, props){

    var konstructor = Element.Constructors.get(tag);
    if (konstructor) return konstructor(props);
    if (typeof tag == 'string') return document.newElement(tag, props);
    return document.id(tag).set(props)
}

......

[/code]
[color=red]return document.id(tag).set(props)[/color]这一行

tag和props打印出来都是undefined

  • 写回答

1条回答 默认 最新

  • chem_zqm 2010-06-26 03:40
    关注

    Element只是个接口。。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?