一般使用的話,直接用utilities.js好了
The utilities.js file rolls up all of the YUI utility components into a single
file; it includes the following components:
* Yahoo Global Object
* Event
* Dom
* Connection Manager
* Animation
* Drag & Drop
* Element
順手記一個js的prototype屬性,YUI里也經常用到。
var F1 = function(param) {
this.testNum = param;
}
var F2 = function(param) {
this.testStr = param;
}
var a = new F1(25);
F2.prototype = a;
var b = F2('hello');
這個時候b還沒有testNum這個property。
如果var c = b.testNum; 這時prototype鏈發生作用,使b有了testNum這個property。
如果設置b.testNum = 30; 那么只改變了b.testNum,而沒有改變a.testNum。
好像就是繼承關系?
誰知道F1 || {} 是什么意思?
再記個JS的dom方法:
1.刪除節點:node.parentNode.removeChild(node)
2.增加節點:document.createElement('div');