dynamic tree menu
1. save following as hogege.html
2. replace "<'" to "<"
3. open the file using IE
==sample==
<'?xml version="1.0" encoding="UTF-8" ?>
<'!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" xml:lang="ja" lang="ja">
<'head>
<'meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<'meta http-equiv="Content-Style-Type" content="text/css" />
<'meta http-equiv="Content-Script-Type" content="text/javascript" />
<'HTML>
<'HEAD>
<'TITLE>Tree Menu Sample<'/TITLE>
<'link rel="stylesheet" href="../css/sample.css" type="text/css" />
<'script language="JavaScript" type="text/javascript" src="../js/sample.js" charset="utf-8"><'/script><'SCRIPT language="JavaScript">
<'!--
if(document.getElementById){
document.writeln('<'style type="text/css" media="all">');
document.writeln('<'!--');
document.writeln('.hidden-menu{display:none;}');
document.writeln('-->');
document.writeln('<'/style>');
}
function showHide(id){
if(document.getElementById(id) == null){ return false; }
var disp = document.getElementById(id).style.display;
if(disp == "block"){
document.getElementById(id).style.display = "none";
}else{
document.getElementById(id).style.display = "block";
}
hideOther(id);
return false;
}
function hideOther(id){
var first = id.substr(0,1);
var second = id.substr(1,1);
var third = id.substr(2,1);
var fourth = id.substr(3,1);
hideFirstPhase(first);
hideSecondPhase(first, second);
hideThirdPhase(first, second, third);
// hideFourthPhase(id);
}
function hideFirstPhase(first) {
for(var i=1; i<'10; i++){
if ( first == i ) {
i++;
}
if(document.getElementById(i*1000) != null){
document.getElementById(i*1000).style.display = "none";
}
}
}
function hideSecondPhase(first, second) {
// if (second == 0) {
// return;
// }
for(var i=1; i<'10; i++){
if(second == i){
i++;
}
hideId = (first*1000) + (i*100);
if(document.getElementById(hideId) != null){
document.getElementById(hideId).style.display = "none";
}
}
}
function hideThirdPhase(first, second, third) {
// if (third == 0) {
// return;
// }
for(var i=1; i<'10; i++){
if(third == i){
i++;
}
hideId = (first*1000) + (second*100) + (i*10);
if(document.getElementById(hideId) != null){
document.getElementById(hideId).style.display = "none";
}
}
}
// -->
<'/SCRIPT>
<'style type="text/css">
@charset "UTF-8";
* {
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
}
/*------------------------------------------------------------------*/
/*-- container --*/
#container {
margin: 0;
padding-top: 20px;
padding-bottom: 20px;
display: block;
position: relative;
width: 100%;
min-height: 100%;
height: 100%;
}
/*------------------------------------------------------------------*/
/*-- header --*/
#header {
padding-left: 0.5em;
border-bottom: 1px solid cornflowerblue;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 20px;
color: cornflowerblue;
}
/*------------------------------------------------------------------*/
/*-- footer --*/
#footer {
position: absolute;
bottom: 0px;
width : 100%;
height: 20px;
color: cornflowerblue;
border-top: 1px solid cornflowerblue;
}
#footer #copyright {
padding-top: 0.5em;
font-size: 8pt;
text-align: center;
}
/*------------------------------------------------------------------*/
/*-- side menu --*/
#tree-menu {
padding: 5px 0px 5px 0px;
border-right: 1px solid cornflowerblue;
float: left;
width: 180px;
max-width: 190px;
height: 100%;
}
#tree-menu li.menu-child {
padding: 1px 1px 1px 10px;
list-style-type: none;
white-space: normal;
display: list-item;
}
#tree-menu li.menu-child a {
color: cornflowerblue;
text-decoration: none;
}
#tree-menu li.menu-child a:link {
color: cornflowerblue;
}
#tree-menu li.menu-child a:visited {
color: cadetblue;
}
#tree-menu li.menu-child a:hover {
color: skyblue;
}
#tree-menu li.menu-child a:active {
color: deepskyblue;
}
/*------------------------------------------------------------------*/
/*-- ope area with treemenu--*/
#ope-area-with-treemenu {
margin-left: 180px;
padding-top: 35px;
position: relative;
display: block;
width: 100%;
height: 100%;
overflow: auto;
}
/*-- sub header --*/
div#sub-header {
padding: 7px 0px 1px 0px;
border-bottom: 1px solid cornflowerblue;
position: absolute;
top: 0px;
width: 99.9%;
height: 35px;
color: cornflowerblue;
text-align: center;
}
/*-- OPE-BODY-PANEL --*/
#ope-body-panel {
position: relative;
width: 100%;
height: 100%;
color: cadetblue;
font-size: 18pt;
text-align: center;
overflow: auto;
}
/*------------------------------------------------------------------*/
<'/style>
<'/HEAD>
<'BODY>
<'div id="container">
<'!-- HEADER START -->
<'div id="header">
Tree Menu Sample
<'/div>
<'!-- HEADER END -->
<'div id="tree-menu">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1000');"/>hoge<'/a>
<'div class="hidden-menu" id="1000" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1100');"/>hogege<'/a>
<'div class="hidden-menu" id="1100" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1110');"/>hogegege<'/a>
<'div class="hidden-menu" id="1110" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1120');"/>hogegege<'/a>
<'div class="hidden-menu" id="1120" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1200');"/>hogege<'/a>
<'div class="hidden-menu" id="1200" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1210');"/>hogegege<'/a>
<'div class="hidden-menu" id="1210" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1220');"/>hogegege<'/a>
<'div class="hidden-menu" id="1220" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'/div>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2000');"/>hoge<'/a>
<'div class="hidden-menu" id="2000" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2100');"/>hogege<'/a>
<'div class="hidden-menu" id="2100" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2110');"/>hogegege<'/a>
<'div class="hidden-menu" id="2110" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2120');"/>hogegege<'/a>
<'div class="hidden-menu" id="2120" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2200');"/>hogege<'/a>
<'div class="hidden-menu" id="2200" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2210');"/>hogegege<'/a>
<'div class="hidden-menu" id="2210" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2220');"/>hogegege<'/a>
<'div class="hidden-menu" id="2220" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'/div>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3000');"/>hoge<'/a>
<'div class="hidden-menu" id="3000" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3100');"/>hogege<'/a>
<'div class="hidden-menu" id="3100" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3110');"/>hogegege<'/a>
<'div class="hidden-menu" id="3110" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3120');"/>hogegege<'/a>
<'div class="hidden-menu" id="3120" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'/div>
<'/li>
<'/ul>
<'br>
<'/div>
<'!--+++++++++++++++++++++++++++++++++++++++++++-->
<'div id="ope-area-with-treemenu">
<'div id="sub-header">
the sample of tree menu
<'/div>
<'div id="ope-body-panel">
<'!-- BODY START -->
<'!-------------------------->
choose a menu!
<'!-------------------------->
<'!-- BODY END -->
<'/div>
<'/div>
<'!--+++++++++++++++++++++++++++++++++++++++++++-->
<'!-- FOOTER START -->
<'div class="clear"><'/div>
<'div id="footer">
<'div id="copyright">
© 2007 8318 All Rights Reserved.
<'/div>
<'/div>
<'!-- FOOTER END -->
<'/div><'!--(id="container")-->
<'/BODY>
<'/HTML>
2. replace "<'" to "<"
3. open the file using IE
==sample==
<'?xml version="1.0" encoding="UTF-8" ?>
<'!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" xml:lang="ja" lang="ja">
<'head>
<'meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<'meta http-equiv="Content-Style-Type" content="text/css" />
<'meta http-equiv="Content-Script-Type" content="text/javascript" />
<'HTML>
<'HEAD>
<'TITLE>Tree Menu Sample<'/TITLE>
<'link rel="stylesheet" href="../css/sample.css" type="text/css" />
<'script language="JavaScript" type="text/javascript" src="../js/sample.js" charset="utf-8"><'/script><'SCRIPT language="JavaScript">
<'!--
if(document.getElementById){
document.writeln('<'style type="text/css" media="all">');
document.writeln('<'!--');
document.writeln('.hidden-menu{display:none;}');
document.writeln('-->');
document.writeln('<'/style>');
}
function showHide(id){
if(document.getElementById(id) == null){ return false; }
var disp = document.getElementById(id).style.display;
if(disp == "block"){
document.getElementById(id).style.display = "none";
}else{
document.getElementById(id).style.display = "block";
}
hideOther(id);
return false;
}
function hideOther(id){
var first = id.substr(0,1);
var second = id.substr(1,1);
var third = id.substr(2,1);
var fourth = id.substr(3,1);
hideFirstPhase(first);
hideSecondPhase(first, second);
hideThirdPhase(first, second, third);
// hideFourthPhase(id);
}
function hideFirstPhase(first) {
for(var i=1; i<'10; i++){
if ( first == i ) {
i++;
}
if(document.getElementById(i*1000) != null){
document.getElementById(i*1000).style.display = "none";
}
}
}
function hideSecondPhase(first, second) {
// if (second == 0) {
// return;
// }
for(var i=1; i<'10; i++){
if(second == i){
i++;
}
hideId = (first*1000) + (i*100);
if(document.getElementById(hideId) != null){
document.getElementById(hideId).style.display = "none";
}
}
}
function hideThirdPhase(first, second, third) {
// if (third == 0) {
// return;
// }
for(var i=1; i<'10; i++){
if(third == i){
i++;
}
hideId = (first*1000) + (second*100) + (i*10);
if(document.getElementById(hideId) != null){
document.getElementById(hideId).style.display = "none";
}
}
}
// -->
<'/SCRIPT>
<'style type="text/css">
@charset "UTF-8";
* {
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
}
/*------------------------------------------------------------------*/
/*-- container --*/
#container {
margin: 0;
padding-top: 20px;
padding-bottom: 20px;
display: block;
position: relative;
width: 100%;
min-height: 100%;
height: 100%;
}
/*------------------------------------------------------------------*/
/*-- header --*/
#header {
padding-left: 0.5em;
border-bottom: 1px solid cornflowerblue;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 20px;
color: cornflowerblue;
}
/*------------------------------------------------------------------*/
/*-- footer --*/
#footer {
position: absolute;
bottom: 0px;
width : 100%;
height: 20px;
color: cornflowerblue;
border-top: 1px solid cornflowerblue;
}
#footer #copyright {
padding-top: 0.5em;
font-size: 8pt;
text-align: center;
}
/*------------------------------------------------------------------*/
/*-- side menu --*/
#tree-menu {
padding: 5px 0px 5px 0px;
border-right: 1px solid cornflowerblue;
float: left;
width: 180px;
max-width: 190px;
height: 100%;
}
#tree-menu li.menu-child {
padding: 1px 1px 1px 10px;
list-style-type: none;
white-space: normal;
display: list-item;
}
#tree-menu li.menu-child a {
color: cornflowerblue;
text-decoration: none;
}
#tree-menu li.menu-child a:link {
color: cornflowerblue;
}
#tree-menu li.menu-child a:visited {
color: cadetblue;
}
#tree-menu li.menu-child a:hover {
color: skyblue;
}
#tree-menu li.menu-child a:active {
color: deepskyblue;
}
/*------------------------------------------------------------------*/
/*-- ope area with treemenu--*/
#ope-area-with-treemenu {
margin-left: 180px;
padding-top: 35px;
position: relative;
display: block;
width: 100%;
height: 100%;
overflow: auto;
}
/*-- sub header --*/
div#sub-header {
padding: 7px 0px 1px 0px;
border-bottom: 1px solid cornflowerblue;
position: absolute;
top: 0px;
width: 99.9%;
height: 35px;
color: cornflowerblue;
text-align: center;
}
/*-- OPE-BODY-PANEL --*/
#ope-body-panel {
position: relative;
width: 100%;
height: 100%;
color: cadetblue;
font-size: 18pt;
text-align: center;
overflow: auto;
}
/*------------------------------------------------------------------*/
<'/style>
<'/HEAD>
<'BODY>
<'div id="container">
<'!-- HEADER START -->
<'div id="header">
Tree Menu Sample
<'/div>
<'!-- HEADER END -->
<'div id="tree-menu">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1000');"/>hoge<'/a>
<'div class="hidden-menu" id="1000" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1100');"/>hogege<'/a>
<'div class="hidden-menu" id="1100" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1110');"/>hogegege<'/a>
<'div class="hidden-menu" id="1110" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1120');"/>hogegege<'/a>
<'div class="hidden-menu" id="1120" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1200');"/>hogege<'/a>
<'div class="hidden-menu" id="1200" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1210');"/>hogegege<'/a>
<'div class="hidden-menu" id="1210" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('1220');"/>hogegege<'/a>
<'div class="hidden-menu" id="1220" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'/div>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2000');"/>hoge<'/a>
<'div class="hidden-menu" id="2000" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2100');"/>hogege<'/a>
<'div class="hidden-menu" id="2100" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2110');"/>hogegege<'/a>
<'div class="hidden-menu" id="2110" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2120');"/>hogegege<'/a>
<'div class="hidden-menu" id="2120" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2200');"/>hogege<'/a>
<'div class="hidden-menu" id="2200" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2210');"/>hogegege<'/a>
<'div class="hidden-menu" id="2210" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('2220');"/>hogegege<'/a>
<'div class="hidden-menu" id="2220" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'/div>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3000');"/>hoge<'/a>
<'div class="hidden-menu" id="3000" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3100');"/>hogege<'/a>
<'div class="hidden-menu" id="3100" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3110');"/>hogegege<'/a>
<'div class="hidden-menu" id="3110" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'li class="menu-child"><'a href="javascript:void(0);" onClick="showHide('3120');"/>hogegege<'/a>
<'div class="hidden-menu" id="3120" style="display: none;">
<'ul>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'li class="menu-child"><'a href="#" title="hogeeeee">hogeeeee<'/a><'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'div/>
<'/li>
<'/ul>
<'/div>
<'/li>
<'/ul>
<'br>
<'/div>
<'!--+++++++++++++++++++++++++++++++++++++++++++-->
<'div id="ope-area-with-treemenu">
<'div id="sub-header">
the sample of tree menu
<'/div>
<'div id="ope-body-panel">
<'!-- BODY START -->
<'!-------------------------->
choose a menu!
<'!-------------------------->
<'!-- BODY END -->
<'/div>
<'/div>
<'!--+++++++++++++++++++++++++++++++++++++++++++-->
<'!-- FOOTER START -->
<'div class="clear"><'/div>
<'div id="footer">
<'div id="copyright">
© 2007 8318 All Rights Reserved.
<'/div>
<'/div>
<'!-- FOOTER END -->
<'/div><'!--(id="container")-->
<'/BODY>
<'/HTML>
