案例:jQuery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/js/jquery.js"></script>
4
<script type="text/javascript">
5
$(document).ready(function(){
6
  $("button").click(function(){
7
    $("p").width(function(n,c){
8
    return c-50;
9
    });
10
  });
11
});
12
</script>
13
</head>
14
<body>
15
<p style="background-color:yellow">这是一个段落。</p>
16
<button>以 50 像素的幅度减少 p 元素的宽度</button>
17
</body>
18
</html>
19