qqmenu_bak.js

来自「物业管理和办公自动化系统」· JavaScript 代码 · 共 96 行

JS
96
字号
function showme(obj1, obj2)
{
	if (moving)
		return;
	moving = true;
	for(i=0;i<document.all.tags('td').length;i++)
		if (document.all.tags('td')[i].className.indexOf('headtd') == 0)
			document.all.tags('td')[i].className = 'headtd1';
	obj2.className = 'headtd2';
	moveme(obj1);
}

function moveme(obj)
{
	idnumber = parseInt(obj.id.substr(4));
	objtop = headheight * (idnumber - 1);
	objbuttom = bodyheight + headheight * (idnumber - 2);
	currenttop = parseInt(obj.style.top);
	if (currenttop >= objbuttom)
	{
		countid = 1;
		for(i=0;i<document.all.tags('div').length;i++)
			if (document.all.tags('div')[i].id == 'item'+countid+'body')
			{
				obj = document.all.tags('div')[i];
				objtop = headheight * (countid - 1);
				if (countid == idnumber)
				{
					moveup(obj,objtop,false);
					break;
				}
				else
					moveup(obj,objtop,true);
				countid++;
			}
	}
	else if ((currenttop <= objtop) && (idnumber < objcount))
	{
		idnumber++;
		countid = objcount;
		for(i=document.all.tags('div').length-1;i>=0;i--)
			if (document.all.tags('div')[i].id == 'item'+countid+'body')
			{
				obj = document.all.tags('div')[i];
				objbuttom = bodyheight + headheight * (countid - 2);
				if (countid == idnumber)
				{
					movedown(obj,objbuttom,false);
					break;
				}
				else
					movedown(obj,objbuttom,true);
				countid--;
			}
	}
	else
		// 最后一条在最上面,点击应该保持不动,但好像死掉了,点击其他的也不能动了。原来是moving状态保持在ismove。把moving改成false就解决问题了
		moving = false;
}

function moveup(obj,objtop,ismove)
{
	currenttop = parseInt(obj.style.top);
	if (currenttop> objtop)
	{
		// ************* modified by zhouqiufang on 2003-1-13 begin
		obj.style.top = currenttop - step;
		/*
		if (currenttop - step)
			obj.style.top = currenttop - step;
		else
		{
			obj.style.top = 0;
			return;
		}
		// ************* modified by zhouqiufang on 2003-1-13 end
		*/
		moveup(obj, objtop, ismove);
		//setTimeout('moveup('+obj.id+','+objtop+','+ismove+')',1);
		return;
	}
	moving = ismove;
}

function movedown(obj,objbuttom,ismove)
{
	currenttop = parseInt(obj.style.top);
	if (currenttop < (objbuttom))
	{
		obj.style.top = currenttop + step;
		movedown(obj,objbuttom,ismove);
		//setTimeout('movedown('+obj.id+','+objbuttom+','+ismove+')',1);
		return;
	}
	moving = ismove;
}

⌨️ 快捷键说明

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