⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhtmlxtoolbar.js

📁 treegred is very good grid for
💻 JS
📖 第 1 页 / 共 2 页
字号:
 if(typeof(id)=="object")id=id.id;
 if(id)this.id=id;else this.id=0;
 td=document.createElement(id._td||"td");
 this.topNod=td;td.align="center";td.style.paddingRight="2";td.style.paddingLeft="2";
 td.innerHTML="<div class='toolbarDividerY'>&nbsp;</div>";
 if(!document.all)td.childNodes[0].style.height="0px";
 return this;
};
 dhtmlXDividerYObject.prototype = new dhtmlXButtonPrototypeObject;
 dhtmlXToolbarDividerYObject=dhtmlXDividerYObject;
 
 

 
 
 function dhtmlXDividerXObject(id){
 if(typeof(id)=="object")id=id.id;
 if(id)this.id=id;else this.id=0;
 td=document.createElement(id._td||"td");
 this.topNod=td;td.align="center";td.style.paddingRight="2";td.style.paddingLeft="2";td.width="4px";
 td.innerHTML="<div class='toolbarDivider'></div >";
 if(!document.all){td.childNodes[0].style.width="0px";td.style.padding="0 0 0 0";td.style.margin="0 0 0 0";}
 return this;
};
 dhtmlXDividerXObject.prototype = new dhtmlXButtonPrototypeObject;
 dhtmlXToolbarDividerXObject=dhtmlXDividerXObject;

 


 
 
 function dhtmlXImageTextButtonObject(src,content,width,height,action,id,tooltip,className,textClassName,disableImage){
 if(typeof(src)!="object")
 src=this._arg2obj(arguments,["src","content","width","height","action","id","tooltip","className","textClassName","disableImage"]);

 if(src.action)this.setSecondAction(src.action);
 this.src=src.src;this.disableImage=src.disableImage;
 this.tooltip=src.tooltip||"";this.id=src.id||0;

 this.className=src.className||"defaultButton";
 td=document.createElement(src._td||"td");this.topNod=td;
 td.style.height=src.height;td.style.width=src.width;td.align="center";
 td.noWrap=true;
 if(!src.textmode){
 this.textClassName=src.textClassName||"defaultButtonText";
 td.innerHTML="<table title='"+this.tooltip+"' width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td valign='center' align='center' valign='middle' style='padding-left:4px;padding-right:4px;'><img src='"+this.src+"' border='0'></td><td width='100%' style='padding-left:5px' align='left' valign='center' class='"+this.textClassName+"'>"+src.content+"</td></tr></table>";
 this.textTag=td.childNodes[0].rows[0].cells[1];
}
 else{
 this.textClassName=src.textClassName||"defaultButtonTextBottom";
 td.innerHTML="<table title='"+this.tooltip+"' width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle'><img src='"+this.src+"' border='0' style='padding-left:2px;padding-right:2px;'></td></tr><tr><td width='100%' align='center' class='"+this.textClassName+"'>"+src.content+"</td></tr></table>";
 this.textTag=td.childNodes[0].rows[1].cells[0];
}
 td.className=this.className;
 td.objectNode=this;
 this.imageTag=td.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
 this.enable();
 if(src.mouseover)
{this._mvImage=src.mouseover;this._mnImage=src.src;}

 return this;
};

 dhtmlXImageTextButtonObject.prototype = new dhtmlXButtonPrototypeObject;
 
 dhtmlXImageTextButtonObject.prototype.setText = function(newText){
 this.textTag.innerHTML=newText;
};

 



 
 
 function dhtmlXImageTextButtonXPObject(src,content,width,height,action,id,tooltip,className,textClassName,disableImage){
 if(typeof(src)!="object")
 src=this._arg2obj(arguments,["src","content","width","height","action","id","tooltip","className","textClassName","disableImage"]);

 src.textmode="bottom";
 return(new dhtmlXImageTextButtonObject(src));
};
 dhtmlXImageTextButtonXPObject.prototype = new dhtmlXButtonPrototypeObject;

 



 
 
 function dhtmlXSelectButtonObject(id,valueList,displayList,action,width,height,className)
{
 if(typeof(id)!="object")
 id=this._arg2obj(arguments,["id","valueList","displayList","action","width","height","className"]);

 if(id.action)this.setSecondAction(id.action);
 this.id=id.id;
 td=document.createElement(id._td||"td");
 this.topNod=td;td.align="center";td.style.width=id.width;

 var sel=document.createElement("select");
 this.selElement=sel;sel.onchange=this._onclickX;sel.objectNode=this;

 if(id.className)sel.className=id.className;
 if(id.width)sel.style.width="100%";

 if(typeof(valueList)=="string"){
 var temp1=valueList.split(",");
 if(displayList)var temp2=displayList.split(",");
 else var temp2=valueList.split(",");
 for(var i=0;i<temp1.length;i++)
{
 sel.options[sel.options.length]=new Option(temp2[i],temp1[i]);
}
}
 else
 if(id.option)
 for(var i=0;i<id.option.length;i++)
{
 sel.options[sel.options.length]=new Option(id.option[i].content,id.option[i].value);
}

 td.appendChild(sel);
 td.className="toolbarNormalButton";
 td.objectNode=this;
 return this;
};


 dhtmlXSelectButtonObject.prototype = new dhtmlXButtonPrototypeObject;
 
 
 dhtmlXSelectButtonObject.prototype.clearOptions=function(){
 var cnt = this.selElement.options.length;
 for(var i=0;i<cnt;i++){
 this.selElement.removeChild(this.selElement.options[0]);
}
};
 
 dhtmlXSelectButtonObject.prototype.disable=function(){
 this.selElement.disabled=true;
};
 
 
 dhtmlXSelectButtonObject.prototype.enable=function(){
 this.selElement.disabled=false;
};
 

 
 dhtmlXSelectButtonObject.prototype._onclickX=function(){
 if((!this.objectNode.persAction)||(this.objectNode.persAction(this.objectNode.selElement.value)))
 if(this.objectNode.action){this.objectNode.action(this.objectNode.id,this.objectNode.selElement.value);}
};

 
 dhtmlXSelectButtonObject.prototype.addOption=function(value,display){
 this.selElement.options[this.selElement.options.length]=new Option(display,value);
};
 
 dhtmlXSelectButtonObject.prototype.removeOption=function(value){
 var z=this.getIndexByValue(value);
 if(z>=0)this.selElement.removeChild(this.selElement.options[z]);
};
 
 dhtmlXSelectButtonObject.prototype.setOptionValue=function(oldValue,newValue){
 var z=this.getIndexByValue(oldValue);
 if(z>=0)this.selElement.options[z].value=newValue;
};
 
 dhtmlXSelectButtonObject.prototype.setOptionText=function(value,newText){
 var z=this.getIndexByValue(value);
 if(z>=0)this.selElement.options[z].text=newText;
};
 
 dhtmlXSelectButtonObject.prototype.setSelected=function(value){
 var z=this.getIndexByValue(value);
 if(z>=0)this.selElement.options[z].selected=true;
};
 
 dhtmlXSelectButtonObject.prototype.getIndexByValue=function(value){
 for(var i=0;i<this.selElement.options.length;i++)
{
 if(this.selElement.options[i].value==value)
 return i;
};
 return -1;
};
 
 

 
 
function dhtmlXTwoStateButtonObject(id,src,content,width,height,action,tooltip,className,textClassName,disableImage,pressedState){
 if(typeof(id)!="object")
 id=this._arg2obj(arguments,["id","src","content","width","height","action","tooltip","className","textClassName","disableImage","pressedState"]);

 if(id.action)this.setSecondAction(id.action);
 this.state=0;
 this.className=id.className||"defaultButton";
 this.textClassName=id.textClassName||"defaultButtonText";

 this.disableImage=id.disableImage;
 this.tooltip=id.tooltip||"";this.id=id.id||0;
 if(id.content)this.textP=id.content.split(',');else this.textP=",".split(',');

 if(id.src)this.srcA=id.src.split(',');else this.srcA=",".split(',');
 this.src=this.srcA[0];

 td=document.createElement(id._td||"td");
 this.topNod=td;
 td.style.height=id.height;td.style.width=id.width;td.align="center";td.noWrap=true;

 td.innerHTML="<table title='"+this.tooltip+"' width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle'><img src='"+this.srcA[0]+"' border='0' style='padding-left:2px;padding-right:2px;'></td><td width='100%' style='padding-left:5px' align='left' class='"+this.textClassName+"'>"+this.textP[0]+"</td></tr></table>";
 td.className=this.className;
 td.objectNode=this;
 this.imageTag=td.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
 this.textTag=td.childNodes[0].childNodes[0].childNodes[0].childNodes[1];

 if(!id.content)this.textTag.style.display="none";
 if(!id.src)this.imageTag.style.display="none";

 this.enable();
 if(convertStringToBoolean(pressedState))
{
 this.state=1;this.topNod.className=this.className+"down";
 if(this.textP[1])this.textTag.innerHTML=this.textP[1];
 if(this.srcA[1])this.imageTag.src=this.srcA[1];
}
 return this;
};

dhtmlXTwoStateButtonObject.prototype = new dhtmlXButtonPrototypeObject;

 
dhtmlXTwoStateButtonObject.prototype._onclickX = function(e,that){
 if(!that)that=this.objectNode;
 if(that.topNod.dstatus)return;
 if(that.state==0){that.state=1;this.className=that.className+"down";}
 else{that.state=0;this.className=that.className;}
 
 if(that.textP[that.state])that.textTag.innerHTML=that.textP[that.state];
 if(that.srcA[that.state])that.imageTag.src=that.srcA[that.state];

 
 if((!that.persAction)||(that.persAction()))
 if(that.action){that.action(that.id,that.state);}

};
 
 dhtmlXTwoStateButtonObject.prototype._onmouseoutX=function(e){
};
 
 dhtmlXTwoStateButtonObject.prototype._onmouseoverX=function(e){
};
 
 dhtmlXTwoStateButtonObject.prototype.getState=function(){
 return this.state;
};
 
dhtmlXTwoStateButtonObject.prototype.setState=function(state){
 this.state=state;
 if(state==0)this.topNod.className=this.className;
 else this.topNod.className=this.className+"down";

 if(this.textP[this.state])this.textTag.innerHTML=this.textP[this.state];
 if(this.srcA[this.state])this.imageTag.src=this.srcA[this.state];
};



 
function dhtmlXSliderButtonObject(id,size,skin,vertical,step,limit,init_pos,shift,className){
 if(typeof(id)!="object")
 var conf=this._arg2obj(arguments,["id","size","skin","vertical","limit","init_pos","shift","className"]);
 else var conf=id;

 var td=document.createElement(conf._td||"TD");
 td.style[(conf.vertical)?"height":"width"]=conf.size+"px";
 var z=new dhtmlxSlider(td,conf);

 this.slider=z;this.id=conf.id;
 this.topNod=td;
 td.className=conf.className||"defaultButton";


 td.objectNode=this;
 z.setOnChangeHandler(function(){
 td.objectNode._onclickX.apply(td);
});
 return this;
}
dhtmlXSliderButtonObject.prototype = new dhtmlXButtonPrototypeObject;

 
dhtmlXSliderButtonObject.prototype._onclickX=function(){
 if((!this.objectNode.persAction)||(this.objectNode.persAction(this.objectNode.getValue())))
 if(this.objectNode.action){this.objectNode.action(this.objectNode.id,this.objectNode.getValue());}
};

 
dhtmlXSliderButtonObject.prototype.getValue = function(){
 return this.slider.getValue();
}

 
dhtmlXSliderButtonObject.prototype.setValue = function(val){
 return this.slider.setValue(val);
}


function dhtmlXLabelButtonObject(width,content,className){
 if(typeof(width)!="object")
 var conf=this._arg2obj(arguments,["width","content","className"]);
 else var conf=width;

 var td=document.createElement(conf._td||"TD");
 td.style.width=parseInt(conf.width)+"px";
 td.innerHTML=conf.content;
 this.topNod=td;
 td.className=conf.className||"defaultButton";
 return this;
}
dhtmlXLabelButtonObject.prototype = new dhtmlXButtonPrototypeObject;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -