源代码如下:
<!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>
<style>
a:hover {
font-size: 10pt; color: #FF6600;
vertical-align:middle;
}
a {
font-size: 10pt; text-decoration: none; color: #676767;
noline:expression(this.onfocus=this.blur);
text-align:left;
vertical-align:middle;
}
#HideDiv{
display:none;
}
</style>
<body>
<form id="form1" name="form1" method="post" action="" >
<table width="372" border="1" align="center" bgcolor="#E6F2F2" bordercolor="#478D8D" style="border-style:none" cellspacing="0" >
<tr>
<td scope="col" align="center" style="border-bottom-style:none" >管理组织架构</td>
</tr>
<tr>
<td >
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
<?php
//从XML文件中加载节点
$xml_file = simplexml_load_file("org.xml");
foreach($xml_file->children() as $node){
?>
<tr>
<td width="38%" align="right">
<img src="images/rootnode.gif" width="15" height="15" border="0" > </img>
</td>
<td width ="62%" left="0px" align="left" ><a href="#" onclick= "ShowNode(<?php echo $node ?>)">
<?php echo $node ?></a>
</td>
</tr>
<tr>
<td width ="38%" align="center" >
</td>
<td width ="62%" >
<div id= <?php echo $node ?> style = "display:none" class="HideDiv" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="left" >
<?php
foreach($node->children() as $value){
?>
<tr>
<td width ="10%" align="right" >
<img src="images/childnode.gif" width="15" height="15" border="0" > </img>
</td>
<td width ="90%" align="left" ><a href='#' > <?php echo $value?></a>
</td>
</tr>
<?php
}
?>
</table>
</div>
</td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<script language="javascript">
function ShowNode(ParentID){
var Div = ParentID;
if (Div.style.display == "none"){
Div.style.display = "block";
}else if (Div.style.display == "block"){
Div.style.display = "none";
}
}
</script>
</form>
</body>
</html>
如何修改实现二级目录的超链接?
<!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>
<style>
a:hover {
font-size: 10pt; color: #FF6600;
vertical-align:middle;
}
a {
font-size: 10pt; text-decoration: none; color: #676767;
noline:expression(this.onfocus=this.blur);
text-align:left;
vertical-align:middle;
}
#HideDiv{
display:none;
}
</style>
<body>
<form id="form1" name="form1" method="post" action="" >
<table width="372" border="1" align="center" bgcolor="#E6F2F2" bordercolor="#478D8D" style="border-style:none" cellspacing="0" >
<tr>
<td scope="col" align="center" style="border-bottom-style:none" >管理组织架构</td>
</tr>
<tr>
<td >
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="left">
<?php
//从XML文件中加载节点
$xml_file = simplexml_load_file("org.xml");
foreach($xml_file->children() as $node){
?>
<tr>
<td width="38%" align="right">
<img src="images/rootnode.gif" width="15" height="15" border="0" > </img>
</td>
<td width ="62%" left="0px" align="left" ><a href="#" onclick= "ShowNode(<?php echo $node ?>)">
<?php echo $node ?></a>
</td>
</tr>
<tr>
<td width ="38%" align="center" >
</td>
<td width ="62%" >
<div id= <?php echo $node ?> style = "display:none" class="HideDiv" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="left" >
<?php
foreach($node->children() as $value){
?>
<tr>
<td width ="10%" align="right" >
<img src="images/childnode.gif" width="15" height="15" border="0" > </img>
</td>
<td width ="90%" align="left" ><a href='#' > <?php echo $value?></a>
</td>
</tr>
<?php
}
?>
</table>
</div>
</td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<script language="javascript">
function ShowNode(ParentID){
var Div = ParentID;
if (Div.style.display == "none"){
Div.style.display = "block";
}else if (Div.style.display == "block"){
Div.style.display = "none";
}
}
</script>
</form>
</body>
</html>
如何修改实现二级目录的超链接?
這個cms裏邊我使用了一個超棒的樹,你可以抠出来使用,绝对超级赞,而且调用的时候非常简单,可做到无限层演示效果:
http://hi.baidu.com/see7di/blog/item/4daf1955bd555bc8b745ae93.html
你看这些图片左侧的那个树就是了.