<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<style>
.{font:12px;}
.listBox{
border:1px solid #999999;
height:400px;
overflow-y:auto;
width:200px;
}
.listBox .listItem, .listBox .listItem_Hover, .listBox .listItem_Selected{
cursor:pointer;
padding:4px 4px 3px 4px;
margin:0px;
color:#000000;
background:;
border:1px solid #FFFFFF;
height:20px;
}
.listBox .listItem_Hover{
color:#0000FF;
border:1px solid #C6CDBE;
}
.listBox .listItem_Selected{
background:#E8EFDF;
border:1px solid #C6CDBE;
}
.listBox .listItemHasChild{
background:url(array.gif) no-repeat 100% 50%;
padding:0px;
margin:0px;
}
#selectPanel{
width:700px;
}
</style>
<table id="selectPanel" cellpadding="0" cellspacing="2">
<tr>
<td><div id="lb_1" class="listBox" style="display:none;"></div></td>
<td><div id="lb_2" class="listBox" style="display:none;"></div></td>
<td><div id="lb_3" class="listBox" style="display:none;"></div></td>
<td><div id="lb_4" class="listBox" style="display:none;"></div></td>
<td><div id="lb_5" class="listBox" style="display:none;"></div></td>
</tr>
</table>
<form id="form1" name="form1" method="post" action="">
<input name="id" type="text" class="inputclass" /><br />
<input name="path" type="text" class="inputclass" />
</form>
<script language="javascript">
//初始化分类项
function initSelectPanel()
{
showListItems(1, 0);
//showListItems(2, 2668); //修改时对应分类要修改的值
//Id_2793.className = "listItem_Selected";//修改时对应分类要修改的值
//Id_2668.className = "listItem_Selected";//修改时对应分类要修改的值
}
//分类项 - 鼠标事件
function listItemOnMouseOver(listItem)
{
if(listItem.className != "listItem_Selected"){
listItem.className += "_Hover";
}
}
//分类项 - 鼠标事件
function listItemOnMouseOut(listItem)
{
if(listItem.className != "listItem_Selected"){
listItem.className = listItem.className.replace("_Hover", "");
}
}
//分类项被点选择
function listItemOnClick(listItem)
{
//alert(listItem);
var cate = cateArr[listItem.id];
var depth = cate.getCateDepth();
clearNextListBoxes(depth);
showListItems(depth + 1, cate.id);
//清理样式listItem.className
var listBox = document.getElementById("lb_" + depth);
if(!listBox) return;
var items = listBox.getElementsByTagName("div");
for(var i=0; i<items.length; i++){
if(items[i].className == "listItem_Selected") items[i].className = "listItem";
}
listItem.className = "listItem_Selected";
//alert(cate.id);
this.document.form1.id.value=cate.id;
if (this.document.form1.path.value.length==0)
{
this.document.form1.path.value = cate.title;
}
else
{
this.document.form1.path.value = this.document.form1.path.value +'>>' +cate.title;
}
}
//显示 depth 深度的分类列表
function showListItems(depth, fid){
var listBox = document.getElementById("lb_" + depth);
if(!listBox) return;
listBox.innerHTML = "";
var item = cateArr[fid];
var listItemIds = item.childIds;
var listItemCount = listItemIds.length;
if(listItemCount == 0) return;
listBox.style.display = "";
if(item.html != ""){
listBox.innerHTML = item.html;
return;
}
for(var i=0; i<listItemCount; i++){
var cate = cateArr[listItemIds[i]];
var title = cate.title;
if(cate.childIds.length > 0){
title = "<div class='listItemHasChild'>" + title + "</div>";
}
listBox.innerHTML += "<div id='" + cate.id + "' id=Id_" + cate.id + " class='listItem' onmouseout='javascript:listItemOnMouseOut(this);' onmouseover='javascript:listItemOnMouseOver(this);' onclick='javascript:listItemOnClick(this);'>"
+ title + "</div>";
}
item.html = listBox.innerHTML; //缓存 html 代码
}
//清空 所有子级 选择框
function clearNextListBoxes(depth)
{
for(var i=depth+1; i<=5; i++){
var listBox = document.getElementById("lb_" + i);
if(!listBox) return;
listBox.innerHTML = "";
listBox.style.display = "none";
}
}
</script>
<script language="javascript">
var cateArr = new Array();
function TCategory(fid, id, title)
{
this.fid = fid;
this.id = id;
this.title = title;
this.childIds = new Array();
this.getCateDepth = getCateDepth;
this.html = ""; //被选中时,下级listBox内的HTML,省得每次计算
if(fid > -1){
cateArr[fid].childIds.push(id);
}
}
function getCateDepth()
{
var depth = 1;
var c = this;
while(c.fid >0){
depth++;
c = cateArr[c.fid];
}
return depth;
}
</script>
<script language="javascript">
cateArr[0] = new TCategory(-1, 0, 'root');
cateArr[1] = new TCategory(0, 1, '照明工业');
cateArr[102] = new TCategory(1, 102, '专门用途灯具');
cateArr[103] = new TCategory(102, 103, '工艺装饰灯具');
cateArr[104] = new TCategory(102, 104, '机床灯具');
cateArr[105] = new TCategory(102, 105, '其他专门用途灯具');
cateArr[106] = new TCategory(102, 106, '红外线灯');
cateArr[107] = new TCategory(102, 107, '工矿灯具');
cateArr[108] = new TCategory(102, 108, '医疗灯具');
cateArr[109] = new TCategory(102, 109, '摄影灯具');
cateArr[110] = new TCategory(102, 110, '舞台灯具');
cateArr[111] = new TCategory(102, 111, '运动场馆灯具');
cateArr[112] = new TCategory(102, 112, '广告灯具');
cateArr[113] = new TCategory(102, 113, '水下灯具');
cateArr[114] = new TCategory(102, 114, '防爆灯具');
cateArr[115] = new TCategory(102, 115, '射灯、杯灯');
cateArr[116] = new TCategory(102, 116, '紫外线灯');
cateArr[117] = new TCategory(102, 117, '灭蚊灯');
cateArr[118] = new TCategory(102, 118, 'led灯具');
cateArr[119] = new TCategory(102, 119, '装饰灯串');
cateArr[120] = new TCategory(1, 120, '车灯');
cateArr[121] = new TCategory(120, 121, '大灯、前照灯');
cateArr[122] = new TCategory(120, 122, '转向灯、角灯');
cateArr[123] = new TCategory(120, 123, '尾灯');
cateArr[124] = new TCategory(120, 124, '雾灯');
cateArr[125] = new TCategory(120, 125, '仪表灯');
cateArr[126] = new TCategory(120, 126, '刹车灯');
cateArr[127] = new TCategory(120, 127, '工作灯、检修灯');
cateArr[128] = new TCategory(120, 128, '其他车灯');
cateArr[129] = new TCategory(1, 129, '指示灯具');
cateArr[130] = new TCategory(129, 130, '其他指示灯具');
cateArr[131] = new TCategory(129, 131, '应急指示灯具');
cateArr[132] = new TCategory(129, 132, '设备指示灯');
cateArr[133] = new TCategory(129, 133, '交通警示灯');
cateArr[134] = new TCategory(129, 134, '航空障碍灯');
cateArr[135] = new TCategory(129, 135, '信号灯');
cateArr[136] = new TCategory(1, 136, '手电筒');
cateArr[137] = new TCategory(136, 137, '普通手电筒');
cateArr[138] = new TCategory(136, 138, '充电手电筒');
cateArr[139] = new TCategory(136, 139, 'LED手电筒');
cateArr[140] = new TCategory(136, 140, '太阳能手电筒');
cateArr[141] = new TCategory(136, 141, '头灯');
cateArr[142] = new TCategory(136, 142, '无电源手电筒');
cateArr[143] = new TCategory(136, 143, '提灯、探照灯');
cateArr[144] = new TCategory(136, 144, '其他手电筒');
cateArr[14] = new TCategory(1, 14, '气体放电灯');
cateArr[15] = new TCategory(14, 15, '氙气灯');
cateArr[16] = new TCategory(14, 16, 'U型荧光灯管');
cateArr[17] = new TCategory(14, 17, '冷阴极荧光灯');
cateArr[18] = new TCategory(14, 18, '霓虹灯管');
cateArr[19] = new TCategory(14, 19, '直型荧光灯管');
cateArr[20] = new TCategory(14, 20, '环型荧光灯管');
cateArr[21] = new TCategory(14, 21, '钠灯');
cateArr[22] = new TCategory(14, 22, '汞灯');
cateArr[23] = new TCategory(14, 23, '金卤灯');
cateArr
评论11
最新资源