table.js

来自「医院信息系统(Hospital Information System」· JavaScript 代码 · 共 82 行

JS
82
字号
function tableCssInit(){
	var trGroup=document.getElementsByTagName("TR");
	var startTRIndex=0;
	if(trGroup[0].className=="caption"){
		startTRIndex=1;
	}
	for(var i=startTRIndex;i<trGroup.length;i++)
	{
		if(i%2==0)
			trGroup[i].style.backgroundColor="#efefef";
		else
			trGroup[i].style.backgroundColor="#ffffff";
	}
}

function changerColor(curTR){
	var trGroup=document.getElementsByTagName("TR");
	var startTRIndex=0;
	if(trGroup[0].className=="caption"){
		startTRIndex=1;
	}
	for(var i=startTRIndex;i<trGroup.length;i++)
	{
		//注意,颜色在匹配的时候一定要用小写
		if(trGroup[i].style.backgroundColor!="#ff9966")
		{
			if(i%2==0)
				trGroup[i].style.backgroundColor="#efefef";
			else
				trGroup[i].style.backgroundColor="#ffffff";
		}
	}
	if(curTR.style.backgroundColor!="#ff9966")
		curTR.style.backgroundColor="yellow";
}

function chooseItem(curTR){
	var trGroup=document.getElementsByTagName("TR");
	var startTRIndex=0;
	if(trGroup[0].className=="caption"){
		startTRIndex=1;
	}
	for(var i=startTRIndex;i<trGroup.length;i++)
	{
		if(i%2==0)
			trGroup[i].style.backgroundColor="#efefef";
		else
			trGroup[i].style.backgroundColor="#ffffff";
	}
	curTR.style.backgroundColor="#ff9966";
	if(curTR.firstChild.firstChild.checked!=null){
		curTR.firstChild.firstChild.click();
	}
}

function changeColorBack(curTR){
	var trGroup=document.getElementsByTagName("TR");
	var startTRIndex=0;
	if(trGroup[0].className=="caption"){
		startTRIndex=1;
	}
	for(var i=startTRIndex;i<trGroup.length;i++)
	{
		if(trGroup[i].style.backgroundColor!="#ff9966")
		{
			if(i%2==0)
				trGroup[i].style.backgroundColor="#efefef";
			else
				trGroup[i].style.backgroundColor="#ffffff";
		}
	}	
}

function changeTitleColor(myTD){
	myTD.style.backgroundColor="orange";
	myTD.style.color="black";
}

function changeTitleColorBack(myTD){
	myTD.style.backgroundColor="#000066";
	myTD.style.color="white";
}

⌨️ 快捷键说明

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