首页javascriptimgjQuery HTML Element - 如何切换特定div和更改img jquery

jQuery HTML Element - 如何切换特定div和更改img jquery

我们想知道如何切换特定div和更改img jquery。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
$('[id="segment"]').toggle(
 function(){
  $(this).find('[id="opener"]').html('open.png');
  $(this).find('[id="segm_content"]').hide(500);
 },
 function(){
  $(this).find('[id="opener"]').html('close.png');
  $(this).find('[id="segm_content"]').show(500);
 }
);
});//]]>  
</script>
</head>
<body>
  <div id="list">
    <div id="segment">
      <div id="opener">
        close.png
      </div>
      <div id="segm_content">this is a test</div>
    </div>
    <div id="segment">
      <div id="opener">
        close.png
      </div>
      <div id="segm_content">content content content</div>
    </div>
  </div>
</body>
</html>