', catId); } if (defaultId >= 0 && defaultId == catId) { obj.options[s-1].selected = true; changeSubCat(obj); }else if (i == 0 && !isFirst && haveBlank == '') { obj.options[i].selected = true; changeSubCat(obj); } } }catch(E){ } } function _clearList(obj) { if (!obj) { return; } for (var i = obj.length - 1; i >= 0; --i) { obj.remove(i); } obj.value = ''; } function _setValue() { var v = 0; var form = document.forms[formName]; var path = ''; var path2 = ''; var idPath = ''; for (var i = 0; i < catSel.length; ++i) { var o = form.elements[catSel[i]]; if (o.value != '') { v = o.value; if (path.length > 0) { path += ' >> '; //path2 += '/'; } if (idPath.length > 0) { //idPath += '-'; } //idPath += v; idPath = v; path += cats[v][0]; //path2 += cats[v][0]; }else { break; } } document.memberform.category.value=idPath; //document.forms[formName].elements[catName].value = v; //if (catPathName && document.getElementById(catPathName)) { // document.getElementById(catPathName).innerHTML = path; //} //if (catIdPath && document.forms[formName].elements[catIdPath]) { // document.forms[formName].elements[catIdPath].value = idPath; //} } function changeSubCat(obj) { if (!obj || !obj.name) { error('obj not found!'); return; } var name = obj.name; var form = document.forms[formName]; if (!form) { error('form not found!'); return; } var selectNum = -1; for (var i = 0; i < catSel.length; ++i) { if (catSel[i] == name) { selectNum = i; break; } } if (selectNum < 0) { debug('can\'t found sub select'); _setValue(); return; } if (selectNum + 1 >= catSel.length || !form.elements[catSel[selectNum + 1]]) { debug('can\'t found sub select 1'); _setValue(); return; } var subSel = form.elements[catSel[selectNum + 1]]; _clearList(subSel); for (var i = selectNum + 1; i < catSel.length; ++i) { if (form.elements[catSel[i]]) { _clearList(form.elements[catSel[i]]); } } if (obj.options[obj.selectedIndex].value == '') { _setValue(); return; } var catId = obj.options[obj.selectedIndex].value; if (!parent[catId]) { debug('no sub select data'); _setValue(); return; } _addList(catId, subSel); _setValue(); } initCat(""); -->