Jquery小效果

jQuery

Some text
Some other text
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  

<html>  

 <head>  

 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />  

 <title>jQuery</title>  

<style type="text/css">  

 </style>  

 <script src="jquery.js" type="text/javascript"></script>  
  <script type="text/javascript">
  $(function(){
             $("div.firstBox").hover(function(){
                                       $(this).text(" Text changed!");
                                       },
                                       
                                       function(){
                                           $("div.secondBox ").append($(this));
                                           
                                           }
                                       )
             
             })
  
  </script>  

 </head>  

 <body>  
<div class="firstBox">Some text</div>
<div class="secondBox ">Some other text</div>

 </body>  

 </html> 

不运行,能猜到效果是怎样的吗.?

很有意思的是$(this)为firstBox作为整个对象直接append到secondBox后面.

posted @ 2012-05-08 16:18  时生  阅读(304)  评论(0编辑  收藏  举报