点击横向菜单的一个时onclick=SecondMenuChanged('" + drSecondMenu["MenuID"].ToString() + "','" + drSecondMenu["AspxPath"].ToString() + "','" + drSecondMenu["BgIconPath"].ToString() + "')被点选菜单背景图由原来的IconPath(从数据库取得)改变成BgIconPath(从数据库取得),当点下一个菜单时这个菜单的背景图再恢复成原来的IconPathjavascript里的方法如下:
function SecondMenuChanged(sSecondMenuID, sAspxPath, sBgIconPath) {
if (sPreSecondMenuID != sSecondMenuID) {
var sPrefix = "SecondMenu_"; // 设置选中状态
var sTrID = sPrefix + sSecondMenuID;
document.getElementById(sTrID).style.background = 'URL(' + sBgIconPath + ')';
var sTrID2 = "Tb_" + sPrefix + sSecondMenuID; //alert(sTrID2);/*拼出作用横向滑动内容的div的id*/
var objTbSecondMenu = new slider(sTrID2, 1, 120, 800, 20, 1, 20);/* 初始化横向滑动的方法*/
objTbSecondMenu.show(); // 取消前一个按钮的选中状态
if (sPreSecondMenuID != "") {
sTrID = sPrefix + sPreSecondMenuID;
/*这样写不行啊,改怎么实现呢????????
document.getElementById(sTrID).parentNode.background = "";
*/ var sTrID3 = "Tb_"+sPrefix + sPreSecondMenuID;
//document.getElementById(sTrID3).style.display = "none"; /*隐藏前一个按钮点出得层*/ if (sPreobjTbSecondMenu != "") {//隐藏上一个打开的横向滑出div
sPreobjTbSecondMenu.hide();
}
}
sPreSecondMenuID = sSecondMenuID;
sPreobjTbSecondMenu = objTbSecondMenu;
// 转到相应地址
if (sAspxPath != "")
document.getElementById("DistrbuteIFrame").src = "DistributeURL.aspx?AOPRight=" + sAspxPath + "&AOPMenuID=" + sSecondMenuID;
}
}
function SecondMenuChanged(sSecondMenuID, sAspxPath, sBgIconPath) {
if (sPreSecondMenuID != sSecondMenuID) {
var sPrefix = "SecondMenu_"; // 设置选中状态
var sTrID = sPrefix + sSecondMenuID;
document.getElementById(sTrID).style.background = 'URL(' + sBgIconPath + ')';
var sTrID2 = "Tb_" + sPrefix + sSecondMenuID; //alert(sTrID2);/*拼出作用横向滑动内容的div的id*/
var objTbSecondMenu = new slider(sTrID2, 1, 120, 800, 20, 1, 20);/* 初始化横向滑动的方法*/
objTbSecondMenu.show(); // 取消前一个按钮的选中状态
if (sPreSecondMenuID != "") {
sTrID = sPrefix + sPreSecondMenuID;
/*这样写不行啊,改怎么实现呢????????
document.getElementById(sTrID).parentNode.background = "";
*/ var sTrID3 = "Tb_"+sPrefix + sPreSecondMenuID;
//document.getElementById(sTrID3).style.display = "none"; /*隐藏前一个按钮点出得层*/ if (sPreobjTbSecondMenu != "") {//隐藏上一个打开的横向滑出div
sPreobjTbSecondMenu.hide();
}
}
sPreSecondMenuID = sSecondMenuID;
sPreobjTbSecondMenu = objTbSecondMenu;
// 转到相应地址
if (sAspxPath != "")
document.getElementById("DistrbuteIFrame").src = "DistributeURL.aspx?AOPRight=" + sAspxPath + "&AOPMenuID=" + sSecondMenuID;
}
}
function SecondMenuChanged(sSecondMenuID, sAspxPath, sBgIconPath, sIconPath) {
if (sPreSecondMenuID != sSecondMenuID) {
var sPrefix = "SecondMenu_"; // 设置选中状态
var sTrID = sPrefix + sSecondMenuID;
// document.getElementById(sTrID).parentNode.className = "SelectMenu";
document.getElementById(sTrID).style.background = 'URL(' + sBgIconPath + ')';
//document.getElementById(sTrID).style.background = 'URL(Images/TopNew/01-1-1.png)';
var sTrID2 = "Tb_" + sPrefix + sSecondMenuID; //alert(sTrID2);/*拼出作用横向滑动内容的div的id*/
var objTbSecondMenu = new slider(sTrID2, 1, 120, 780, 20, 1, 20); /* 初始化横向滑动的方法*/
objTbSecondMenu.show(); // 取消前一个按钮的选中状态
if (sPreSecondMenuID != "") {
sTrID = sPrefix + sPreSecondMenuID;
document.getElementById(sTrID).style.background = 'URL(' + sPreSecondIconPath + ')';
var sTrID3 = "Tb_"+sPrefix + sPreSecondMenuID;
//document.getElementById(sTrID3).style.display = "none"; /*隐藏前一个按钮点出得层*/ if (sPreobjTbSecondMenu != "") {//隐藏上一个打开的横向滑出div
sPreobjTbSecondMenu.hide();
}
}
sPreSecondMenuID = sSecondMenuID;
sPreobjTbSecondMenu = objTbSecondMenu;
sPreSecondIconPath = sIconPath;
// 转到相应地址
if (sAspxPath != "")
document.getElementById("DistrbuteIFrame").src = "DistributeURL.aspx?AOPRight=" + sAspxPath + "&AOPMenuID=" + sSecondMenuID;
}
}