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

推荐订阅源

cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Security Affairs
PCI Perspectives
PCI Perspectives
Google Online Security Blog
Google Online Security Blog
W
WeLiveSecurity
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
P
Privacy & Cybersecurity Law Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Cyberwarzone
Cyberwarzone
L
Lohrmann on Cybersecurity
TaoSecurity Blog
TaoSecurity Blog
V
Visual Studio Blog
博客园 - 聂微东
Scott Helme
Scott Helme
博客园 - 【当耐特】
K
Kaspersky official blog
Security Latest
Security Latest
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
MyScale Blog
MyScale Blog
Schneier on Security
Schneier on Security
WordPress大学
WordPress大学
博客园 - 叶小钗
C
Check Point Blog
V2EX - 技术
V2EX - 技术
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
T
Tor Project blog
Apple Machine Learning Research
Apple Machine Learning Research
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
雷峰网
雷峰网
博客园_首页
美团技术团队
Y
Y Combinator Blog
C
CERT Recently Published Vulnerability Notes
AWS News Blog
AWS News Blog
月光博客
月光博客
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
C
Cybersecurity and Infrastructure Security Agency CISA

博客园 - 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>