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;
&
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐĿǰ¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×î¶¥¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×î¶¥¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
JavascriptÊý×é¼°Æä²Ù×÷[ת]
2009-06-10 10:10
±¾ÎĽéÉÜÈçϼ¸¸ö·½ÃæµÄÄÚÈÝ:
1.ÈçºÎ´´½¨Êý×é
2.ÈçºÎ¶ÔÊý×é½øÐвÙ×÷£¨Ìí¼Ó,ɾ³ý,¶ÁÈ¡)
3.Êý×é³£¼û·½·¨ºÍÊôÐÔ
ÈçºÎ´´½¨Ò»¸öÊý×é,Ò»°ãµØ¸ù¾Ý³õʼ»¯É趨¼òµ¥·ÖΪ3ÖÖ:
1.µ¥´¿´´½¨Êý×é:
var arr=new Array();
Òªµã:ÓÃnew¹Ø¼ü×Ö´´½¨Êý×é¶ÔÏóArray(),Array()¶ÔÏóÊÇÒ»¸ö±¾µØÀ ......
javascript£º»ù´¡ÖªÊ¶
1 ´´½¨½Å±¾¿é
1: <script language=”javascript”>
2: javascript code goes here
3: </script>
2 Òþ²Ø½Å±¾´úÂë
1: <script language=”javascript”>
2: <!--
3: document.write(“Hello”);
4: // -->
5: </script>
ÔÚ ......
Á´Ê½µ÷ÓÃÊÇÒ»¸öÓï·¨ÕÐÊý.°üº¬Á½¸ö²¿·Ö:
1.Ò»¸ö´´½¨HTMLÔªËØµÄ¶ÔÏóµÄ¹¤³§
2.¶ÔÕâ¸öHTMLÔªËØÖ´ÐеIJÙ×÷µÄ·½·¨
[¸öÈËÀí½â:½«HTMLÔªËØ°ü×°³É¶ÔÏó,ÔÚ¶ÔÏóÉÏÌí¼Ó·½·¨(ÖØµãÔÚreturn this)]
¹¹ÔìÆ÷
(function(){
//Use a private class
function _$(els){
this.elements = [];
for(var i=0; i<els.length; ......