JavaScriptÊ÷
/** ÅäÖòÎÊý */
function TreeConfig() {
this.showIco = true;
this.showCheckBox = false;
this.checkBoxName = "_TREE_CHECKBOX_";
this.checkBoxRelated = false;
}
/**
* ½ÚµãÀà
* ½ÚµãĿǰĬÈÏÖ§³ÖµÄÊôÐÔÓÐ:
* text, url, target, cb, cbname, cbchecked, cbval, ico, icoFile, icoOpen
*/
function Node(id, parentId, attributes) {
this.id = id; // ½Úµã×ÔÉíid
this.parent = parentId || ""; // ¸¸id
this.attributes = attributes || {}; // ½ÚµãÊôÐÔ
this._created = false;
this._expanded = false;
this._checked = false;
}
// µÃµ½½ÚµãÊôÐÔ
Node.prototype.getAttribute = function(key) {
var attr = this.attributes[key];
return (attr==undefined || attr=="")? null : attr;
}
// µÃµ½½ÚµãÊôÐÔ
Node.prototype.setAttribute = function(key, value) {
this.attributes[key] = value;
}
/** Ê÷Àà */
function TissonTree(instanceName, config) {
this.instanceName = instanceName || "tree"; // ʵÀýÃû
this.nodes = {}; // ËùÓнڵ㼯
this.nodeArray = null; // °üº¬ËùÓнڵãµÄÊý×é
this.nodeLink = {}; // ¸¸-×Ó½Úµã¶ÔÓ¦¹ØÏµ¼¯
this.rootId = "-1"; // ĬÈϸù½Úµãid
this._baseImagesPath = "/SmtCCS_tkms/images/tree/"; // ͼƬµÄ»ù±¾Â·¾¶
this._checkedNodes = {};
this.selectedNode = null;
this.selectedNodeId = "";
this.nextSearchIndex = 0;
this.searchText = "";
this.treeStage = null;
&
Ïà¹ØÎĵµ£º
optionsÊý×é
¡¡¡¡¸ÃÊý×éÊÇselect¶ÔÏóµÄÒ»¸öÊôÐÔ,¼´Ñ¡Ôñ¿òÖеÄËùÓÐÑ¡Ïî(<OPTION>)µÄÒ»¸öÁÐ±í¡£
¡¡¡¡ÊôÐÔ
¡¡¡¡defaultSelected Ñ¡ÏîÁбíÖеÄȱʡѡÏî
¡¡¡¡index Ñ¡ÏîÁбíÖÐijѡÏîµÄË÷ÒýλÖÃ
¡¡¡¡length Ñ¡ÏîÁбíÖеÄÑ¡ÏîÊý(<OPTIONS>)
¡¡¡¡name Ñ¡ÏîÁбíµÄÃû×Ö(NAMEÌØÐÔ)
¡¡¡¡selected ±íÊ¾Ñ ......
±íµ¥µÄÑéÖ¤ÔÚʵ¼ÊµÄ¿ª·¢µ±ÖÐÊǼþºÜ·³ËöÓÖÎÞȤµÄÊÂÇé
½ñÌìÔÚ×öÒ»¸öСÏîÄ¿µÄʱºò,ÐèÒªJSÑéÖ¤,ѰÕÒµ½Ò»¸ö±È½ÏºÃµÄ¶«Î÷
µØÖ·ÈçÏÂ:
http://blog.csdn.net/goodfunman/archive/2005/10/21/513338.aspx
http://blog.csdn.net/yhl_621/archive/2006/03/04/615273.aspx
http://blog.csdn.net/NetDreamwing/archive/2004/1 ......
µ± jQuery ÔÚ2006Äê1ÔÂÏÖÉíʱ£¬¸øÎҵĵÚÒ»Ó¡Ïó£¬ÊÇÕâÍæÒâ¶ù¹¹ÔìµÃºÜ¾«Ã÷¡£»ùÓÚCSSÑ¡ÔñÆ÷£¨CSS selectors£©À´´òµãÒ»ÇУ¬Æä˼·Ï൱ÁéÇÉ£¨²Î¿¼getElementsBySelector£©¡£µ«Á´ºÐ¹¤Ê£¨chaining stuff£©¿´ÆðÀ´¸üÏñ¸öàåÍ·£¬²¢ÇÒÕûÌå¿´À´£¬jQuery¿âÌṩµÄ¹¦Äܲ¢²»Äܸ²¸ÇËùÓлù´¡ÐԵĶ«Î÷¡£Òò´ËÎҶ϶¨£¬jQueryÖ»»áê¼»¨Ò»ÏÖ¡£
¼¸¸ö ......
¡¡¡¡Ñ§Ï°jQueryÒѾÓаëÄêʱ¼äÁË¡£ÔÚʵ¼ÊÓ¦ÓÃÖУ¬»ù´¡º¯ÊýÒѾËãÊǵÃÐÄÓ¦ÊÖÁË¡£µ«ÊÇ£¬¶ÔÓÚÎÒ×Ô¼ºÀ´Ëµ£¬»¹´æÔÚÒ»¸öÈíÀß——ÖªÆäÈ»¶ø²»ÖªÆäËùÒÔÈ»¡£¶øÒòÎªÇ°ÃæÏîÄ¿µÄѹÁ¦µÈ¸÷·½ÃæµÄÎÊÌ⣬ÎÒһֱûÓÐʱ¼ä¶Ô´Ë×÷²¹¾ÈµÄ´ëÊ©¡£
¡¡¡¡ÏÖÔÚÖÕÓÚ¾ö¶¨ÒªÀëÖ°ÁË£¬ÎÒÓÖÔٴγÉΪ×Ô¼ºÊ±¼äµÄÕæÕýÖ÷ÈË¡£Ò»Ö±Ïë×ö¶øÃ»·¨×öµÄʶ¼ÒªÔÚ ......
Á´Ê½µ÷ÓÃÊÇÒ»¸öÓï·¨ÕÐÊý.°üº¬Á½¸ö²¿·Ö:
1.Ò»¸ö´´½¨HTMLÔªËØµÄ¶ÔÏóµÄ¹¤³§
2.¶ÔÕâ¸öHTMLÔªËØÖ´ÐеIJÙ×÷µÄ·½·¨
[¸öÈËÀí½â:½«HTMLÔªËØ°ü×°³É¶ÔÏó,ÔÚ¶ÔÏóÉÏÌí¼Ó·½·¨(ÖØµãÔÚreturn this)]
¹¹ÔìÆ÷
(function(){
//Use a private class
function _$(els){
this.elements = [];
for(var i=0; i<els.length; ......