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 ......
转自http://topic.csdn.net/u/20091014/12/44b0ac69-5228-429b-854a-a91e3736f1d4.html?64368
每一项都是JS中的小技巧,但十分的实用!
1.document.write(”"); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document->html->(head,body)
4.一个浏览器窗口中的DOM顺序是:window->(navig ......
学习jQuery已经有半年时间了。在实际应用中,基础函数已经算是得心应手了。但是,对于我自己来说,还存在一个软肋——知其然而不知其所以然。而因为前面项目的压力等各方面的问题,我一直没有时间对此作补救的措施。
现在终于决定要离职了,我又再次成为自己时间的真正主人。一直想做而没法做的事都要在 ......
// 关闭窗口事件
function closeWindow(){
if(event.clientX>document.body.clientWidth) {
& ......