jquery 操作滚动条滚动 animate checkbox操作

来源:互联网 发布:xampp apache 编辑:程序博客网 时间:2024/06/07 14:56

代码如下:

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
  {
  $(".btn1").click(function(){
    if(!$("#box").is(":animated")){
     $("#comtent").animate({height : "+=50"});
  } else {
alert("ddd");
}
   
  });
  $(".btn2").click(function(){
    //$("#comtent").animate({height : "-=50"});
    $("#comtent").css({height : "-=50"});
  });


  $("#test1").click(function(){
  $("#comtent").animate({scrollTop: "+=17"});
$("[name='item']:checkbox").attr("checked",true);
});


  $("#test2").click(function(){
    $("#comtent").animate({scrollTop: "-=17"});
$("[name='item']:checkbox").attr("checked",false);
});


$("#change").click(function(){
 $("[name='item']:checkbox").each(function(){
  this.checked = !this.checked;
});
});
});
</script>
</head>
<body>
<textarea id="comtent" cols="10" rows="8">
测试+测试+测试+测试+测试+测试+测试+
测试+测试+测试+测试+测试+测试+测试+测试+测试+
测试+测试+测试+测试+测试+测试+测试+
测试+测试+测试+测试+测试+
测试+测试+测试+
</textarea>
<button class="btn1">Animate</button>
<button class="btn2">Reset</button>


<button id="test1">next</button>
<button id="test2">prev</button>
<button id="change">反选</button>


<input type="checkbox" name="item"/>
<input type="checkbox" name="item"/>
</body>
</html>