惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

www.infosecurity-magazine.com
www.infosecurity-magazine.com
Vercel News
Vercel News
G
Google Developers Blog
MyScale Blog
MyScale Blog
The Register - Security
The Register - Security
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
D
DataBreaches.Net
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
V2EX - 技术
V2EX - 技术
F
Fortinet All Blogs
博客园_首页
S
Secure Thoughts
GbyAI
GbyAI
S
Security Affairs
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Security Archives - TechRepublic
Security Archives - TechRepublic
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Heimdal Security Blog
A
About on SuperTechFans
P
Proofpoint News Feed
H
Help Net Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Y
Y Combinator Blog
L
LINUX DO - 最新话题
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
博客园 - 叶小钗
A
Arctic Wolf
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
人人都是产品经理
人人都是产品经理
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Security Latest
Security Latest
The Hacker News
The Hacker News
T
Tor Project blog
O
OpenAI News
博客园 - 三生石上(FineUI控件)
PCI Perspectives
PCI Perspectives
量子位
大猫的无限游戏
大猫的无限游戏
Stack Overflow Blog
Stack Overflow Blog

博客园 - GO-NET

jQuery选择器总结(转) Js操作Excel常用方法 DataView不能按中文排序问题解决 浮动层居中的对话框效果演示 javascript获得图片的大小 长宽 ajax form提交 javascript设置分页 url参数为page 网页鼠标提示 写一个触发器。从tb_control里删除一条记录,自动把该记录添加到另一个表tb_ctrlHistor中 sql读取指定字符前的字符 数据库对象命名参考 【转】 正则表达式入门教程 权限设计 【数据库和代码】 无限级treeview设计 C#编码建议 【程序权限设计】 ASP.NET设置ie打印两法 生意就是这样做成的 SQL Server 存储过程的经典分页
查找父元素和子元素
GO-NET · 2008-03-29 · via 博客园 - GO-NET

<!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=gb2312" />
<title>查找父元素和子元素</title>
<script lanuage="JavaScript">
function FindParentElement(element, tagName)
{
    
while(element != null && element.tagName != tagName )
    {
        element 
= element.parentElement;
        
    
        
if ( element != null && element.tagName == tagName )
        {
            
//element.style.display="none";
            
            
//alert(element.tagName);
            elem=FindChildElement(element,"UL");
            
if(elem.style.display!="none")
            {
                elem.style.display
="none"
            }
            
else
            {
                elem.style.display
="block"
            }
            
        }
    
    }
    
return null;
}
</script>
<script lanuage="JavaScript">
function FindChildElement(element, tagName)
{
    
var isFounded = false;
    
var elements = element;
    
var result = element;
    
if ( element.tagName == tagName )
    {
        
return element;
    }
    
while(!isFounded && elements != null && result != null && result.tagName != tagName)
    {
        elements 
= elements.childNodes;
        
forvar i=0 ; elements != null && i < elements.length ; i++ )
        {
            result 
= elements.item(i);
            
var result2 = FindChildElement(result, tagName);
            
if ( result == null || result2 == null )
            {
                
continue;
            }
            
if ( result.tagName == tagName || result2.tagName == tagName )
            {
                
if ( result2.tagName == tagName )
                {
                    result 
= result2;
                }
                isFounded 
= true;
                
break;
            }
        }
    }
    
if ( isFounded )
    {
        
return result;
    }
    
else
    {
        
return null;
    }
}
</script>
</head><body>
<div class="col-box">
  
<h3>商品分类</h3>
  
<div id="navcontainer" style="display:block">
        
<ul>
      
<li><href="#" onclick="FindParentElement(this,'LI');"><strong>化妆品</strong></a> 
                
<ul>
                    
<li><href="category.php?id=34">沐浴</a></li>
                    
<li><href="category.php?id=35">套装</a></li>
                    
<li><href="category.php?id=25">护肤品</a></li>
                    
<li><href="category.php?id=31">洗发</a></li>
                    
<li><href="category.php?id=33">美发</a></li>
                  
</ul>
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=2"><strong>通讯</strong></a> 
                
<ul>
                    
<li><href="category.php?id=24">手机</a></li>
                  
</ul>
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=14"><strong>书籍</strong></a> 
                
<ul>
                    
<li><href="category.php?id=23">文学</a></li>
                  
</ul>
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=17"><strong>硬件</strong></a> 
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=19"><strong>宠物</strong></a> 
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=15"><strong>玩具</strong></a> 
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=20"><strong>游戏</strong></a> 
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=13"><strong>数码</strong></a> 
                
<ul>
                    
<li><href="category.php?id=22">电子词典</a></li>
                  
</ul>
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=16"><strong>服装</strong></a> 
              
</li>
    
</ul>
        
<ul>
      
<li><href="category.php?id=18"><strong>家电</strong></a> 
              
</li>
    
</ul>
      
</div>
</div>
 
</body>
</html>