<html>
<head>
<script language=javascript>
//cMenuClosed,cMenuOpened
var cMenuClosed = "+";
var cMenuOpened = "-";
var cPreWidth = "10%";
var cContentWidth = "90%";
var cChildTrNamePre = "SubMenu_"; //ALL
var Root = new Array("ALL", "-1");
var Offices = new Array();
Offices[0] = "";
Offices[1] = new Array();
Offices[1][0] = "AA";
Offices[1][1] = "1";
Offices[1][2] = "0";
Offices[1][3] = new Array();
Offices[1][3][0] = "";
Offices[1][3][1] = new Array("b","100","0");
Offices[1][3][2] = new Array("c", "101", "0");
Offices[1][3][3] = new Array("d", "103", "0");
Offices[1][3][4] = new Array("e", "104", "0");
Offices[1][3][5] = new Array("f", "105", "0"); Offices[2] = new Array();
Offices[2][0] = "BB";
Offices[2][1] = "1";
Offices[2][2] = "0";
Offices[2][3] = new Array();
Offices[2][3][0] = "";
Offices[2][3][1] = new Array("g","200","0");
Offices[2][3][2] = new Array("h", "201", "0");
Offices[2][3][3] = new Array("i", "203", "0");
Offices[2][3][4] = new Array("j", "204", "0");
Offices[2][3][5] = new Array("k", "205", "0"); var OfficeSelect = '200';
var OfficeSelectPath = new Array('','1'); function TNodes_Detail_Ck(Aele, eleid){
var tableObj = document.getElementById(eleid);
if(tableObj.style.display == "none"){
Aele.innerHTML = cMenuOpened;
tableObj.style.display == "";
}else{
Aele.innerHTML = cMenuClosed;
tableObj.style.display == "none";
}
} function inOfficeSelectPath(OfficeCode){
for(var i=1; i<OfficeSelectPath.length-1; i++)
if (OfficeSelectPath[i] == OfficeCode) return true;
return false;
} function CreateOfficesTree(){
//first create root
var debugid=0;
try{
//alert('');
document.writeln('<tr>');
document.writeln(' <td width="'+cPreWidth+'" align="right">');
if(Offices.length==0){
document.writeln(cMenuClose);
}else{
var bOpen = OfficeSelectPath.length>1?true:false;
document.writeln(' <a href="javascript:TNodes_Detail_Ck(this,\''+cChildTrNamePre+Root[1]+'\')">' + bOpen?cMenuOpened:cMenuClosed + '</a>');
}
document.writeln(' </td>');
document.writeln(' <td width="'+cContentWidth+'">');
document.writeln(' <a href="main.cgi?OfficeCode='+Root[1]+'" target="mainFrame">'+cChildTrNamePre+Root[0]+'</a>');
document.writeln(' </td>');
document.writeln('</tr>');
debugid=1;
//second create offices
if(Offices.length>1){
document.writeln(' <tr id="'+cChildTrNamePre+Root[1]+'">');
document.writeln(' <td width="10%" align="right">');
document.writeln(' </td>');
document.writeln(' <td width="90%">');
document.writeln(' <table width="100%" cellpadding="0" cellspacing="0" border="1">');
//output Office level 1
for(var i=1; i<Offices.length; i++){
var bOpen = inOfficeSelectPath(Offices[i][1]);
document.writeln(' <tr>');
document.writeln(' <td align="right">');
if(Offices[i][2]=='0'){
document.writeln(' '+cMenuOpened);
}
else{
document.writeln(' <a href="javascript:TNodes_Detail_Ck(this,\''+cChildTrNamePre+Offices[i][1]+'\')">' + bOpen?cMenuOpened:cMenuClosed + '</a>');
}
document.writeln(' </td>');
document.writeln(' <td>');
document.writeln(' <a href="main.cgi?OfficeCode='+Offices[i][1]+'" target="mainFrame">'+Offices[i][0]+'</a>');
document.writeln(' </td>');
document.writeln(' </tr>');
//output Office level 2
if(Offices[i][3].length>1){
document.writeln(' <tr>');
document.writeln(' <td align="right">');
document.writeln(' </td>');
document.writeln(' <td>');
document.writeln(' <table width="100%" cellpadding="0" cellspacing="0" border="1">');
document.writeln(' </table>');
document.writeln(' </td>');
document.writeln(' </tr>'); }
}
debugid=2;
document.writeln(' </table>');
document.writeln(' </td>');
document.writeln(' </tr>');
}
}catch(e){
alert(e+" "+debugid);
}
}
</script>
</head>
<body topmargin="0" leftmargin="0">
<table width="100%" cellpadding="0" cellspacing="0" border="1">
<tr>
<td width="100%" bgcolor="#99CCCC" align="center" colspan=3>
tree
</td>
</tr>
<script language=javascript>
CreateOfficesTree();
</script>
</table>
</body>
</html>
<head>
<script language=javascript>
//cMenuClosed,cMenuOpened
var cMenuClosed = "+";
var cMenuOpened = "-";
var cPreWidth = "10%";
var cContentWidth = "90%";
var cChildTrNamePre = "SubMenu_"; //ALL
var Root = new Array("ALL", "-1");
var Offices = new Array();
Offices[0] = "";
Offices[1] = new Array();
Offices[1][0] = "AA";
Offices[1][1] = "1";
Offices[1][2] = "0";
Offices[1][3] = new Array();
Offices[1][3][0] = "";
Offices[1][3][1] = new Array("b","100","0");
Offices[1][3][2] = new Array("c", "101", "0");
Offices[1][3][3] = new Array("d", "103", "0");
Offices[1][3][4] = new Array("e", "104", "0");
Offices[1][3][5] = new Array("f", "105", "0"); Offices[2] = new Array();
Offices[2][0] = "BB";
Offices[2][1] = "1";
Offices[2][2] = "0";
Offices[2][3] = new Array();
Offices[2][3][0] = "";
Offices[2][3][1] = new Array("g","200","0");
Offices[2][3][2] = new Array("h", "201", "0");
Offices[2][3][3] = new Array("i", "203", "0");
Offices[2][3][4] = new Array("j", "204", "0");
Offices[2][3][5] = new Array("k", "205", "0"); var OfficeSelect = '200';
var OfficeSelectPath = new Array('','1'); function TNodes_Detail_Ck(Aele, eleid){
var tableObj = document.getElementById(eleid);
if(tableObj.style.display == "none"){
Aele.innerHTML = cMenuOpened;
tableObj.style.display == "";
}else{
Aele.innerHTML = cMenuClosed;
tableObj.style.display == "none";
}
} function inOfficeSelectPath(OfficeCode){
for(var i=1; i<OfficeSelectPath.length-1; i++)
if (OfficeSelectPath[i] == OfficeCode) return true;
return false;
} function CreateOfficesTree(){
//first create root
var debugid=0;
try{
//alert('');
document.writeln('<tr>');
document.writeln(' <td width="'+cPreWidth+'" align="right">');
if(Offices.length==0){
document.writeln(cMenuClose);
}else{
var bOpen = OfficeSelectPath.length>1?true:false;
document.writeln(' <a href="javascript:TNodes_Detail_Ck(this,\''+cChildTrNamePre+Root[1]+'\')">' + bOpen?cMenuOpened:cMenuClosed + '</a>');
}
document.writeln(' </td>');
document.writeln(' <td width="'+cContentWidth+'">');
document.writeln(' <a href="main.cgi?OfficeCode='+Root[1]+'" target="mainFrame">'+cChildTrNamePre+Root[0]+'</a>');
document.writeln(' </td>');
document.writeln('</tr>');
debugid=1;
//second create offices
if(Offices.length>1){
document.writeln(' <tr id="'+cChildTrNamePre+Root[1]+'">');
document.writeln(' <td width="10%" align="right">');
document.writeln(' </td>');
document.writeln(' <td width="90%">');
document.writeln(' <table width="100%" cellpadding="0" cellspacing="0" border="1">');
//output Office level 1
for(var i=1; i<Offices.length; i++){
var bOpen = inOfficeSelectPath(Offices[i][1]);
document.writeln(' <tr>');
document.writeln(' <td align="right">');
if(Offices[i][2]=='0'){
document.writeln(' '+cMenuOpened);
}
else{
document.writeln(' <a href="javascript:TNodes_Detail_Ck(this,\''+cChildTrNamePre+Offices[i][1]+'\')">' + bOpen?cMenuOpened:cMenuClosed + '</a>');
}
document.writeln(' </td>');
document.writeln(' <td>');
document.writeln(' <a href="main.cgi?OfficeCode='+Offices[i][1]+'" target="mainFrame">'+Offices[i][0]+'</a>');
document.writeln(' </td>');
document.writeln(' </tr>');
//output Office level 2
if(Offices[i][3].length>1){
document.writeln(' <tr>');
document.writeln(' <td align="right">');
document.writeln(' </td>');
document.writeln(' <td>');
document.writeln(' <table width="100%" cellpadding="0" cellspacing="0" border="1">');
document.writeln(' </table>');
document.writeln(' </td>');
document.writeln(' </tr>'); }
}
debugid=2;
document.writeln(' </table>');
document.writeln(' </td>');
document.writeln(' </tr>');
}
}catch(e){
alert(e+" "+debugid);
}
}
</script>
</head>
<body topmargin="0" leftmargin="0">
<table width="100%" cellpadding="0" cellspacing="0" border="1">
<tr>
<td width="100%" bgcolor="#99CCCC" align="center" colspan=3>
tree
</td>
</tr>
<script language=javascript>
CreateOfficesTree();
</script>
</table>
</body>
</html>
解决方案 »
- 求一个数组代码-----------在线等!!!
- iframe 编辑器赋值问题
- google map 控件的问题
- 一个主页用window.open(),打开一网站,主页能否知道这个网站是否打开?
- 想编写一个留言板,需要准备什么?
- 这两个程序片段是什么意思
- 请教个触发问题
- 关于JS树型结构(100分)
- ^_^请教:如何让浮动窗口从页面内嵌的flash动画表面经过??((顶者有分!!))
- 如何可以在打开一个IE后改变自己的大小和风格?
- 请问谁用过superdullwolf (超级大笨狼) 的三级关联菜单,省,市,县!请进
- 怎么验证文框中输入时间(带分秒)的合法性,格式如2002-7-26 11:03:00
var bOpen = inOfficeSelectPath(Offices[i][1]);
document.writeln(' <tr>');
document.writeln(' <td align="right">');
if(Offices[i][2])=='0'){ //<----这里多个")"
document.writeln(' '+cMenuOpened);