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;
&
Ïà¹ØÎĵµ£º
µ¥Ìåģʽ
Óŵã:°Ñ´úÂë×éÖ¯µÃÒ»Ö²¢¸ôÀë,¸üÈÝÒ×ÔĶÁºÍά»¤,Ìá¸ßÎȶ¨ÐÔ;ÓÃÓÚÓÅ»¯,ÌáÉýÐÔÄÜ
ȱµã:¿Éµ¼ÖÂÇ¿ñîºÏ
5.1 µ¥ÌåµÄ»ù±¾½á¹¹
var Singleton = {
attribute1 : true,
attribute2 : 10,
method1 : function(){},
method2 : function(){}
};
Ñϸñ°´¶¨ÒåÀ´Ëµ,C1²»ÊÇÒ»¸öµ¥Ìå,ÒòΪËü²»ÊÇÒ»¸ö¿ÉʵÀ ......
±¾ÎÄÀ´×Ô£º
http://articles.sitepoint.com/article/adobe-air-pref-javascript
ÔÚÎÒ Ö®Ç°µÄÌû×ÓÀ ÎÒ¼¤¶¯µØ¿ªÊ¼ÁËÎҵĵÚÒ»¸öAIRÓ¦Ó㬽Ð×öHarpoon, ½öʹÓÃHTML, CSS, ºÍJavaScript¡£ÎÒµ±Ê±Ã»Ê±¼äÌÖÂÛµÄÒ»¸öÌØµã¾ÍÊÇ£¬Äã¿ÉÒÔʹÓÃÒ»¸öXMLÎļþ´æ´¢ºÍ¼ìË÷Ó¦ÓóÌÐòÊ×Ñ¡Ïî¡£
......
JavaScriptÎĵµ¶ÔÏó(DOM)
navigator
screen
window
history
location
frames[]; Frame
document
anchors[]; links[]; Link
applets[]
embeds[]
forms[]; Form
Button
Checkbox
elements[]; Element
Hidden
Password
Radio
Reset
Select
options[]; Option
Submit
Text
......
Á´Ê½µ÷ÓÃÊÇÒ»¸öÓï·¨ÕÐÊý.°üº¬Á½¸ö²¿·Ö:
1.Ò»¸ö´´½¨HTMLÔªËØµÄ¶ÔÏóµÄ¹¤³§
2.¶ÔÕâ¸öHTMLÔªËØÖ´ÐеIJÙ×÷µÄ·½·¨
[¸öÈËÀí½â:½«HTMLÔªËØ°ü×°³É¶ÔÏó,ÔÚ¶ÔÏóÉÏÌí¼Ó·½·¨(ÖØµãÔÚreturn this)]
¹¹ÔìÆ÷
(function(){
//Use a private class
function _$(els){
this.elements = [];
for(var i=0; i<els.length; ......
// ¹Ø±Õ´°¿Úʼþ
function closeWindow(){
if(event.clientX>document.body.clientWidth) {
& ......