// JScript 文件
var inputID, inputName;
function ExpandSubCategory(iCategoryID, FahterID) {
var li_father = document.getElementById("li_" + iCategoryID);
if (li_father.getElementsByTagName("li").length > 0) //如果已经加载了下级节点则直接展开,不必在去读取数据
{
ChangeStatus(iCategoryID);
return;
}
//打开时显示稍等
switchNote(iCategoryID, true);
//AJAX回调函数,加载节点
used_car.BLL.T_BrandBaby.GetList("dm='品牌' and fID=" + iCategoryID, GetSubCategory_callback);
}
function ExpandSubCategoryAgain(iCategoryID, FahterID) {
var li_father = document.getElementById("li_" + iCategoryID);
li_father.className = "Opened";
//打开时显示稍等
switchNote(iCategoryID, true);
//AJAX回调函数,加载节点
used_car.BLL.T_BrandBaby.GetList("dm='品牌' and fID=" + iCategoryID, GetSubCategory_callback);
}
function GetSubCategory_callback(response) {
var dt = response.value.Tables[0];
if (dt.Rows.length > 0) {
var iCategoryID = dt.Rows[0].fID; //父ID
}
var li_father = document.getElementById("li_" + iCategoryID);
var ul_sub = document.getElementById("ulTree_" + iCategoryID);
if (ul_sub != null) {
li_father.removeChild(ul_sub)
}
var ul = document.createElement("ul");
ul.id = "ulTree_" + iCategoryID
for (var i = 0; i < dt.Rows.length; i++) {
if (used_car.BLL.T_BrandBaby.GetList("dm='品牌' and fID=" + dt.Rows[i].id).value.Tables[0].Rows.length<1)
// {
// if (dt.Rows[i].ProductStyle_IsChild == 1) //如果已没有下一级节点
{
var li = document.createElement("li");
li.className = "Child";
li.id = "li_" + dt.Rows[i].id;
var img = document.createElement("img");
img.id = dt.Rows[i].id;
img.className = "s";
img.src = "../../css/s.gif";
var a = document.createElement("a");
var id = dt.Rows[i].id;
a.href = "javascript:OpenDocument('" + dt.Rows[i].id + "','" + dt.Rows[i].name + "');";
a.innerHTML = dt.Rows[i].name.sub(14);
a.title = dt.Rows[i].name;
}
else //如果还有下级节点
{
var li = document.createElement("li");
li.className = "Closed";
li.id = "li_" + dt.Rows[i].id;
var img = document.createElement("img");
img.id = dt.Rows[i].id;
img.className = "s";
img.src = "../../css/s.gif";
img.onclick = function () {
ExpandSubCategory(this.id);
};
img.alt = "展开/折叠";
var a = document.createElement("a");
a.href = "javascript:ExpandSubCategory(" + dt.Rows[i].id + ",'editCate');";
a.innerHTML = dt.Rows[i].name.sub(14);
a.title = dt.Rows[i].name;
}
li.appendChild(img);
li.appendChild(a);
ul.appendChild(li);
}
li_father.appendChild(ul);
//先显示稍等。。。
switchNote(iCategoryID, false);
}
// 叶子节点的单击响应函数
function OpenDocument(iCategoryID, Action) {