chinamootools.com
Mootools对象 - Object
http://www.chinamootools.com/object.html
A compact javascript framework. MooTools Core v1.4.5. Object.each(obj, fn[, bind]);. Bind - (object, optional)函数绑定到此对象执行(函数内部this指向到此对象)。 Fn(item, key, object). Alerts 'The first day of the week is Sunday', 'The second day of the week is Monday', etc.: Object.each({first: 'Sunday', second: 'Monday', third: 'Tuesday'}, function(value, key){ alert('The ' key ' day of the week is ' value); });. Var merged = Object.merge(obj1, obj2[, obj3[, .] );. Var clone = Object.clone(obj);. Fn(value, key, object). Var m...
chinamootools.com
Mootools中文手册 - Number
http://www.chinamootools.com/number.html
A compact javascript framework. MooTools Core v1.4.5. Number.from ( ARG ) ;. Number.from('12') / returns 12 Number.from('hello') / returns null. Var random = Number.random(min, max);. Number.random(5, 20); / returns a random number between 5 and 20. MyNumber.limit(min, max);. 12)limit(2, 6.5); / returns 6.5 (-4).limit(2, 6.5); / returns 2 (4.3).limit(2, 6.5); / returns 4.3. Precision - (number, optional: defaults to 0)小数点后的位数。 MyNumber.times(fn[, bind]);. Fn - (function)要循环执行的函数,循环的索引将传递给此函数。
chinamootools.com
Mootools 1.4教程 - Element
http://www.chinamootools.com/element.html
A compact javascript framework. MooTools Core v1.4.5. Var myElement = document.id(el);. Var myElement = document.id('myElement');. Var div = document.getElementById('myElement'); div = document.id(div); / the element with all the Element methods applied. 函数是document.id函数的别名,如果$被其它javascript库使用,Mootools将不重写$.(不建议使用多个冲突的js库). Var myElements = $ (argument);. Element, element - (element)任意数量的元素作为参数. Elements) - 一个类数组的元素集合,已经被document.id扩展为mootools Elemment对象. A'); / returns all anchor elements in the page.
chinamootools.com
Mootools浏览器对象 - Browser
http://www.chinamootools.com/browser.html
A compact javascript framework. MooTools Core v1.4.5. Browser.Features.xpath - (boolean) True如果浏览器支持XPath。 Browser.Features.air - (boolean) True如果浏览器支持AIR。 Browser.Features.query - (boolean) True如果浏览器支持querySelectorAll。 Browser.Features.json - (boolean) True如果浏览器有一个原生的JSON对象。 Browser.Features.xhr - (boolean) True如果浏览器支持原生XMLHTTP对象。 Browser.ie - (boolean) True如果当前浏览器是IE。 Browser.firefox - (boolean) True如果当前浏览器是Firefox。 Browser.safari - (boolean) True如果当前浏览器是Safari。 Browser.Platform.name - (string)...Brows...
chinamootools.com
Mootools事件侦听 - Element/Delegation
http://www.chinamootools.com/element_delegation.html
A compact javascript framework. MooTools Core v1.4.5. Delegation是一个常用的方法侦听一个事件,此方法通过侦听父元素来捕获子元素事件,类似于Jquery的live方法,侦听动态内容和高交互页面时使用这个方法。 MyElement.addEvent(typeSelector, fn);. TypeSelector - (string) 事件名称和css选择器。 Fn - (function) 事件函数. You can reference the element clicked with the second / Argument passed to your callback clicked.setStyle('color', '#777'); });. MyElement').addEvents({ / monitor an element for mouseover mouseover: fn, / but only monitor child links for clicks 'click:relay(a)': fn2 });.
chinamootools.com
Mootools元素事件 - Element/Event
http://www.chinamootools.com/element_event.html
A compact javascript framework. MooTools Core v1.4.5. MyElement.addEvent(type, fn);. Type - (string) 事件名,没有'on'。 Fn - (function) 事件函数。 Div id="myElement" Click me. /div. MyElement').addEvent('click', function(){ alert('clicked! MyElement.removeEvent(type, fn);. Type - (string) 事件名称。 Fn - (function) 删除的函数。 Var destroy = function(){ alert('Boom: ' this.id); } / this refers to the Element. $('myElement').addEvent('click', destroy); / later. $('myElement').removeEvent('click', destroy);. Var myElement = $('m...
chinamootools.com
Mootools函数 - Function
http://www.chinamootools.com/function.html
A compact javascript framework. MooTools Core v1.4.5. Var foo = Function.from(obj);. Var fn = Function.from(42); alert(fn() ; / alerts '42' var fn2 = Function.from(fn); alert(fn2() ; / alerts '42'. Function.attempt(fn[, fn, fn, fn, .]);. MyFunction.extend(key, value); / Or myFunction.extend(object);. Var myFunction = function(){}; myFunction.extend('alert', function(text){ alert(text); }); myFunction.alert('Hello! Using objects myFunction.extend({ alert: function(text){ alert(text); } });. Var myFunction...
chinamootools.com
Mootools类说明 - Class
http://www.chinamootools.com/class.html
A compact javascript framework. MooTools Core v1.4.5. Var MyClass = new Class(properties);. 也基类有同名方法,用this.parent访问基类的同名方法,所以你可以重写方法. Implements与Extends类似,但Implements可以多继承,Implements应该放在Extends之后,但在其它属性之前. Var Cat = new Class({ initialize: function(name){ this.name = name; } }); var myCat = new Cat('Micia'); alert(myCat.name); / alerts 'Micia' var Cow = new Class({ initialize: function(){ alert('moooo'); } });. 改变基类的原型,和new Class(Implements:function(){})一样,但方便修改已存在的类. Var Animal = new Class({ initialize:...
chinamootools.com
Mootools位置坐标 - Element/Dimensions
http://www.chinamootools.com/element_dimensions.html
A compact javascript framework. MooTools Core v1.4.5. 如果需要测量没有被display(包含父类没有display),需要使用 Element.measure. MyElement.scrollTo(x, y);. MyElement.scrollTo(x, y);. Var size = myElement.getSize(); alert('The element is ' size.x ' pixels wide and ' size.y 'pixels high.');. Var scroll = $('myElement').getScrollSize(); alert('My element can scroll to ' scroll.y 'px'); / alerts 'My element can scroll down to 820px'. Relative - (Element, defaults to the document) 如果设置,则相对于这个元素。 Translate by Jobin Sun.