如何学好java

如何学好java,其实很简单,只要用心体会,慢慢积累!
posts - 106, comments - 7, trackbacks - 0, articles - 3
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

多选反选

Posted on 2011-11-27 21:54 哈希 阅读(162) 评论(0)  编辑  收藏 所属分类: Js and Jquery 常用总结

<!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>无标题文档</title>
<script language="javascript">
 function searchFriend(){
  //得到所有的复选框
  var s=document.getElementById("allFriend");
  var ack=document.getElementsByName("chkFriend");
  for(var i=0;i<ack.length;i++){
   if(ack[i].type=="checkbox"){
    ack[i].checked=s.checked;
   }
  }
 }
 
 function rsearchFriend(){
  var ack=document.getElementsByName("chkFriend");
  for(var i=0;i<ack.length;i++){
   if(ack[i].type=="checkbox"){
    ack[i].checked=!ack[i].checked;
   }
  }
 }
 
 
 
 
</script>
</head>

<body>
<form name="chkFriend" method="post" action="">
  <p>你想交一个什么样的朋友呢,请选择:</p>
  <p>
   <!-- 所有的复选框名字需要调整一致 -->
    <input type="checkbox" name="chkFriend" value="温柔"> 温柔
    <input type="checkbox" name="chkFriend" value="年轻"> 年轻
    <input type="checkbox" name="chkFriend" value="漂亮"> 漂亮
    <input type="checkbox" name="chkFriend" value="爱洗衣服">爱洗衣服
    <input type="checkbox" name="chkFriend" value="爱做饭">爱做饭
</p>
  <p>
  <input type="checkbox" onClick="searchFriend()" id="allFriend" name="allFriend" value="以上全选">以上全选
</p>
<input type="checkbox" onClick="rsearchFriend()" id="rallFriend" name="rallFriend" value="反选">反选
</p>
<p>
<input type="button" name="Submit" value="寻找目标">
</p>
</form>

</body>
</html>


只有注册用户登录后才能发表评论。


网站导航: