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

📄 coolbutton.js

📁 本系统的使用可以将工作的部分流程使用计算机的办公自动化处理
💻 JS
字号:
var popupWin_btn=null;
function coolButton()
{
	this.oParent=null;
	this.direction="H";
	if (arguments[0]!=null)
  {
    if (typeof arguments[0]=="string")
    {
    	this.oParent=document.getElementById(arguments[0]);
    	if (this.oParent==null)
    		this.oParent=document.getElementsByName(arguments[0])[0];
    }
	}
	if (arguments[1]!=null)
		this.direction=arguments[1].toUpperCase();

	if (this.oParent==null)
    this.oParent=document.body;

	this.cssFile="coolButton.css";

	this.oTable=document.createElement("TABLE");
	if (this.oParent!=document.body)
		this.oTable.className="parentNoBody";
	else
		this.oTable.className="parentBody";

	this.oTable.id="coolButtonBar";
	this.imagesPath="";
	if (this.direction=="H")
	{
		this.oTr=this.oTable.insertRow();
		this.oTd=this.oTr.insertCell();
		this.oTd.width="100%";
		this.oTd.className="LeftArrow";
		this.oTd.id="LeftArrow";
		this.oTd.style.cursor="hand";
	}
	this.popupcoolBar=null;
	this.hasPupupBar=false;
	this.oParent.appendChild(this.oTable);
}

coolButton.prototype.createButton=function()
{
	var tempTd,tempTr;
	var iLeft=0;
	if (arguments.length<5)
		return;
	if (typeof arguments[1]!="function")
		return;

	if (this.oParent!=document.body)
		iLeft=this.oParent.offsetLeft;

	if (this.direction=="H" && this.oTd.offsetLeft>document.body.clientWidth-105-iLeft)
	{
		return this.createPupupBar(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);

	}

	if (this.direction=="H")
		tempTd=this.oTr.insertCell(this.oTr.cells.length-1);
	else if (this.direction=="V")
	{
		tempTr=this.oTable.insertRow();
		tempTd=tempTr.insertCell();
	}
	else
	 return;

	var tempBtn=document.createElement("BUTTON");
	tempBtn.hideFocus=true;
	tempBtn.className="imgBtn";
	tempBtn.name=arguments[0];
	tempBtn.id=arguments[0];
	tempBtn.onclick=arguments[1];
	tempBtn.title=arguments[2];
	var tempImg=document.createElement("IMG");
	tempImg.src=this.imagesPath+"/"+arguments[4];
	tempBtn.disabled=(typeof arguments[5]=="boolean")?arguments[5]:false;
	tempImg.align="absmiddle";
	tempBtn.appendChild(tempImg);
	tempTd.appendChild(tempBtn);

	return document.getElementById(arguments[0]);
};

coolButton.prototype.sperateButton=function()
{
	var tempTd,tempTr,count;
	if (arguments.length<1)
		count=1;
	else
		count=arguments[0];

	if (this.hasPupupBar)
	{
		var tempTr=this.popupcoolBar.insertRow();
		var tempTd=tempTr.insertCell();
		tempTd.height="10px";
		tempTd.innerHTML ="";
		for(var i=0; i<count; i++)
			tempTd.innerHTML +="&nbsp;";
	}
	else
	{
		if (this.direction=="H")
			tempTd=this.oTr.insertCell(this.oTr.cells.length-1);
		else if (this.direction=="V")
		{
			tempTr=this.oTable.insertRow();
			tempTd=tempTr.insertCell();
		}
		else
		 return;
		tempTd.innerHTML ="";
		for(var i=0; i<count; i++)
			tempTd.innerHTML +="&nbsp;";
	}
};

coolButton.prototype.createPupupBar=function()
{
	var d;
	if (popupWin_btn==null)
	{
		popupWin_btn=window.createPopup();
		this.hasPupupBar=true;
		d=popupWin_btn.document;
		d.write("<html><head></head><link rel=\"STYLESHEET\" type=\"text/css\" href=\""+this.cssFile+"\"><body class=\"CoolBar\"></body></html>");
		alert("<html><head></head><link rel=\"STYLESHEET\" type=\"text/css\" href=\""+this.cssFile+"\"><body class=\"CoolBar\"></body></html>");
		this.popupcoolBar=d.createElement("TABLE");
		this.popupcoolBar.id="coolPanel";
		this.popupcoolBar.className="parentNoBody";
		d.body.appendChild(this.popupcoolBar);

		this.oTd.innerText="6";
		this.oTd.style.cursor="hand";
		this.oTd.onclick=this.showBar;
	}

	d=popupWin_btn.document;
	var tempTr=this.popupcoolBar.insertRow();
	var tempTd=tempTr.insertCell();
	var tempBtn=d.createElement("BUTTON");
	tempBtn.hideFocus=true;
	tempBtn.className="imgBtn";
	tempBtn.name=arguments[0];
	tempBtn.id=arguments[0];
	tempBtn.onclick=arguments[1];
	tempBtn.title=arguments[2];
	tempBtn.disabled=(typeof arguments[5]=="boolean")?arguments[5]:false;
	var tempImg=d.createElement("IMG");
	tempImg.src=this.imagesPath+"/"+arguments[4];
	tempImg.align="absmiddle";
	tempBtn.appendChild(tempImg);
	tempBtn.innerHTML+="&nbsp;"+arguments[3];
	tempTd.appendChild(tempBtn);

	return d.getElementById(arguments[0]);
};


coolButton.prototype.showBar=function()
{
	var oTable=popupWin_btn.document.getElementById("coolPanel");
	var iBtnNums=popupWin_btn.document.getElementsByTagName("BUTTON");
	var iPopupHeight=parseInt(oTable.rows.length*54+(oTable.rows.length<5?4:2));
	popupWin_btn.show(-110,37,110,iPopupHeight,document.getElementById("LeftArrow"));
};

coolButton.prototype.setEnabled=function()
{
	var oObj,benabled=false;

	if (arguments.length<1)
		return;

	if (typeof arguments[0]=="string")
  {
  	oObj=document.getElementById(arguments[0]);
  	if (oObj==null)
  		oObj=document.getElementsByName(arguments[0])[0];
  }
  else if (typeof arguments[0]=="object")
  	oObj=arguments[0];
  if (oObj==null)
  	return;

  if (typeof arguments[1]=="boolean")
  	benabled=!arguments[1];

  oObj.disabled=benabled;

  if (oObj.childNodes.length>0 && oObj.childNodes[0].tagName=="IMG")
  	oObj.childNodes[0].className=benabled?"disabled":"enabled";


}

function setEnabled()
{
	var oObj,benabled=false;
	if (arguments.length<2)
		return;
	oObj = arguments[0];
	if (oObj==null)
		return;

	if (typeof arguments[1]=="boolean")
		benabled=!arguments[1];

	oObj.disabled=benabled;

	if (oObj.childNodes.length>0 && oObj.childNodes[0].tagName=="IMG")
		oObj.childNodes[0].className=benabled?"disabled":"enabled";


}

//查询按钮
coolButton.prototype.queryButton=function()
{
	if (arguments.length<2)//没有参数
		return;
	if (typeof arguments[0]!="function")
		return;
	return this.createButton("btnQuery",arguments[0],arguments[1],"查询","query.gif",arguments[2]);
};

⌨️ 快捷键说明

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