function hideMenu()
{
objHeadMenu.style.filter = "blendTrans(duration=0.50) progid:DXImageTransform.Microsoft.Shadow(color=#323232, direction=135, strength=3)";
if (objHeadMenu.filters.blendTrans.status != 2)
{
objHeadMenu.filters.blendTrans.apply();
objHeadMenu.style.visibility = "hidden";
objHeadMenu.filters.blendTrans.play();
}
}
//加列宽
function SetCWP(valWidth)
{
var cTitle = DataTitles[columnRC].split("#");
var cWidth = parseInt(cTitle) + parseInt(valWidth);
DataTitles[columnRC] = cTitle[0] + "#" + cWidth + "#" + cTitle + "#" + cTitle;
WriteTable();
}
//减列宽
function SetCWM(valWidth)
{
var cTitle = DataTitles[columnRC].split("#");
var cWidth = parseInt(cTitle) - parseInt(valWidth);
if (cWidth <= 0) return;
DataTitles[columnRC] = cTitle[0] + "#" + cWidth + "#" + cTitle + "#" + cTitle;
WriteTable();
}
/*
右键菜单上的两个调整列宽的文本框的KeyDown事件,用于捕捉"Enter"时调整列宽并隐藏菜单
*/
function CWKeyDown()
{
if (event.keyCode == 13)
{
var oEl = event.srcElement;
if (oEl.id == "txtCWPlus")
SetCWP(txtCWPlus.value);
if (oEl.id == "txtCWMinus")
SetCWM(txtCWMinus.value);
hideMenu();
}
}
function createMenu()
{
var txtHTML = "<div class=\"coolMenuItem\" style=''padding-top: 1px;'' onclick=\"SortTableAsc();hideMenu();\"><img src=\"images/asc.gif\" width=\"16\" height=\"16\">按升序排序</div>";
txtHTML += "<div class=\"coolMenuItem\" style=''padding-top: 1px;'' onclick=\"SortTableDesc();hideMenu();\"><img src=\"images/desc.gif\" width=\"16\" height=\"16\">按降序排序</div>";
txtHTML +="<div class=\"coolMenuDivider\"></div>";
txtHTML += "<div class=\"coolMenuItem\" style=''padding-top: 1px;'' onclick=\"ResetTable();hideMenu();\"><img src=\"images/blank.gif\" width=\"16\" height=\"16\">锁定列</div>";
txtHTML += "<div class=\"coolMenuDivider\"></div>";
txtHTML += "<div class=\"coolMenuItem\" style=''padding-top: 1px;'' onClick=\"SetCWP(txtCWPlus.value);\" onMouseOver=\"txtCWPlus.focus();\"><img src=\"images/blank.gif\" width=\"16\" height=\"16\">列宽 + <input type=\"text\" id=\"txtCWPlus\" class=\"sinput\" value=\"20\" onKeyDown=\"CWKeyDown();\"> px</div>";
txtHTML += "<div class=\"coolMenuItem\" style=''padding-top: 1px;'' onclick=\"SetCWM(txtCWMinus.value);\" onMouseOver=\"txtCWMinus.focus()\"><img src=\"images/blank.gif\" width=\"16\" height=\"16\">列宽 - <input type=\"text\" id=\"txtCWMinus\" class=\"sinput\" value=\"20\" onKeyDown=\"CWKeyDown();\"> px</div>";
objHeadMenu.className = "coolMenu";
objHeadMenu.innerHTML = txtHTML;
window.document.body.insertAdjacentElement("afterBegin", objHead