parents的用法

2015-03-02 13:46:49  访问(1468) 赞(0) 踩(0)

  • 
    <!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>parents的用法</title> 
    <script type="text/javascript" src="<%=jQuery%>"></script> 
    <script type="text/javascript"> 
    $(document).ready(function() {
    	$("a").hover(function() {
    		$(this).parents("p").addClass("highlight");
    	}, function() {
    		$(this).parents("p").removeClass("highlight");
    	});
    });
    </script> 
    <style>
    .highlight {
        background:gray;
    	border: 3px dotted #eee;
    }
    </style>
    
    <%=VersionHideInfo%>
    
    </head> 
    <body> 
    <p>这里没用<p>This is probably the most common mishap. The remedy is simple--yank! It's most easily done
    	with two people. One to restrain the bird and the <a href="#"> This is a link. Hover me 
    	toThis is a link. Hover me toThis is a link. Hover me toThis is a link. Hover me to
    	highlight the parent paragraph.</a> other to pull the feather. Use pliers, or a hemostat. Tweezers won't
    	work on primaries. Make certain that the wing bones are firmly supported or you can break the wing.
    	Clamp onto the feather and give a sharp tug in the direction of the feather. The feather will come
    	out. Next, apply gentle, direct pressure to the follicle where the feather was to stop the bleeding.
    	Dab some styptic powder on it, as it will help stop the bleeding as well. Let the bird rest. Ask
    	your vet or breeder to demonstrate exactly how to pull a blood feather if you're apprehensive about
    	doing it.</p></p>
    
    	
    	<p>This is probably the most common mishap. The remedy is simple--yank! It's most easily done
    	with two people. One to restrain the bird and the <a href="#"> This is a link. Hover me to
    	highlight the parent paragraph.</a> other to pull the feather. Use pliers, or a hemostat. Tweezers won't
    	work on primaries. Make certain that the wing bones are firmly supported or you can break the wing.
    	Clamp onto the feather and give a sharp tug in the direction of the feather. The feather will come
    	out. Next, apply gentle, direct pressure to the follicle where the feather was to stop the bleeding.
    	Dab some styptic powder on it, as it will help stop the bleeding as well. Let the bird rest. Ask
    	your vet or breeder to demonstrate exactly how to pull a blood feather if you're apprehensive about
    	doing it.</p>
    
    <!--hover(over, out)
    一个模仿悬停事件(鼠标移动到一个对象上面及移出这个对象)的方法。这是一个自定义的方法,它为频繁使用的任务提供了一种“保持在其中”的状态。 当鼠标移动到一个匹配的元素上面时,会触发指定的第一个函数。
    当鼠标移出这个元素时,会触发指定的第二个函数。而且,会伴随着对鼠标是否仍然处在特定元素中的检测(例如,处在div中的图像),如果是,则会继续保持“悬停”状态,而不触发移出事件(修正了使用mouseout事件的一个常见错误)。
    over (Function): 鼠标移到元素上要触发的函数 
    out (Function): 鼠标移出元素要触发的函数 
    示例
    jQuery 代码:
    $("p").hover(function(){ $(this).addClass("over"); },function(){ $(this).addClass("out"); });
    
    
    parents( String expr )
    取得一个包含着所有匹配元素的唯一祖先元素的元素集合(不包含根元素)。
    -->
    
    </body> 
    </html> 
    


上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)