例子:好友列表选中效果

<style type="text/css">

*{ margin:0px auto; padding:0px; font-family:微软雅黑; font-size:16px;}

.f{ width:200px; height:30px; background-color:#63C; color:white; text-align:center; line-height:30px; vertical-align:middle; margin-top:3px}

.f:hover{ cursor:pointer;}

</style>

<div style="width:200px; height:600px; margin-top:30px">

<div class="f" onclick="Xuan(this)" onmouseover="Bian(this)" onmouseout="Hui(this)" xz="0">张三</div>

<div class="f" onclick="Xuan(this)" onmouseover="Bian(this)" onmouseout="Hui(this)" xz="0">李四</div>

<div class="f" onclick="Xuan(this)" onmouseover="Bian(this)" onmouseout="Hui(this)" xz="0">王五</div>

<div class="f" onclick="Xuan(this)" onmouseover="Bian(this)" onmouseout="Hui(this)" xz="0">赵六</div>

<div class="f" onclick="Xuan(this)" onmouseover="Bian(this)" onmouseout="Hui(this)" xz="0">马七</div>

</div>

<script type="text/javascript">
 
 function Xuan(a)
 {
  var attr = document.getElementsByClassName("f");
  
  for(var i=0;i<attr.length;i++)
  {
   attr[i].style.backgroundColor = "#63C";
   attr[i].setAttribute("xz","0");
  }
  a.setAttribute("xz","1");
  a.style.backgroundColor = "#F63";
 }
 
 function Bian(a)
 {
  var attr = document.getElementsByClassName("f");
  
  for(var i=0;i<attr.length;i++)
  {
   if(attr[i].getAttribute("xz")=="0")
   {
    attr[i].style.backgroundColor = "#63C";
   }
  }
  
  a.style.backgroundColor = "#F63";
 }
 
 
 function Hui(a)
 {
  var attr = document.getElementsByClassName("f");
  
  for(var i=0;i<attr.length;i++)
  {
   if(attr[i].getAttribute("xz")=="0")
   {
    attr[i].style.backgroundColor = "#63C";
   }
  }
 }
 
</script>

时间: 2024-08-30 11:35:19

例子:好友列表选中效果的相关文章

鼠标事件和表单事件+好友列表选中效果+侧面菜单下拉效果

通用:onclick 鼠标单击ondblclick 鼠标双击onmouseover 鼠标放上onmouseout 鼠标离开onmousemove 鼠标移动 表单:onchang 表单的值改变onblur 失去焦点onfocus 获得焦点onselect 选中 2.好友列表选中效果 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/

Js效果:图片轮播;选项卡;侧面菜单下拉效果;进度条效果;滑动效果;好友列表选中效果;点击选中显示效果

选项卡效果表: <body><div id="aaa"> <div class="bbb" style="width:50px; height:30px; background-color:#3F0" onclick="Show('d1')">娱乐</div> <div class="bbb" style="width:50px; height

JS实例之列表选中,实现类似好友列表选中效果

1 <head> 2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 3 <title>无标题文档</title> 4 <style type="text/css"> 5 *{margin:0px auto; padding:0px;} 6 #wai{width:100px; height:110

基于Qt的类似QQ好友列表抽屉效果的实现

前段时间在忙毕业设计,所以一直没有更新博客.今天答辩完以后,将对我的毕业设计进行模块展示,供Qt初学者进行参考. 毕业设计题目:Linux系统下基于Qt的局域网即时通信系统设计与实现 其中我有一个类似于QQ的好友列表,然后对好友可以进行分组管理,毕设中具体效果图如下: 网上查寻到的设计思路: 1.采用QToolBox的方式,虽然看起来有点样子,但是并不是我们所熟悉的好友列表,比如:http://blog.csdn.net/qianguozheng/article/details/6719074

day01好友列表折叠效果实现

1.实现效果            2.关键点:每个分组的展开和折叠,主要是对每组的行数进行设置,展开为count,折叠为0 3.思想思路:先实现数据模型逻辑-->展示基本数据-->自定义cell-->自定义cellHeaderView视图-->在cellHeaderView中设置协议,controller中遵守协议,实现cellHeaderView点击事件的传递(即好友列表折叠点击事件的实现) 4.主要代码 1)friend ,group数据模型的定义 1 // 2 // Fri

好友列表选中

当选中一个人时,该背景颜色改变,移动鼠标,鼠标移上变色,离开变回. <style type="text/css"> *{ margin:0px auto; padding:0px; font-family:"微软雅黑";} #wai{ width:100%; height:300px; margin-top:20px;} #names{ width:300px; height:300px;} .name{ width:300px; height:50px

JavaScript实现的购物车效果-好友列表效果

JavaScript实现的购物车效果,当然这个效果可以运用在好多地方,比如好友的选择,人力资源模块,计算薪资,人员的选择等等.下面看类似某种购物车的效果图: code: goodsCar.js:这个js写成了一个单独的文件.主要是控制上面的列表显示的. window.onload=function(){ initStore(); }; var goods=["火腿","美女","御姐","火星一日游","跑车&quo

WPF—QQ界面(五):QQ好友分组列表的效果实现 及 截稿

效果分析: 1.鼠标左键单击 分组 的组名,能够弹出一个下拉列表,并且左边的向右箭头转成向下: 2.弹出的下拉列表中包含好友的头像,好友的昵称,还有好友的个性签名或最新动态: 3.当鼠标移到好友这一行,能够将一行的背景色置蓝或置橙: 4.当鼠标移到好友的头像上,能够悬浮显示好友的个人信息. 除了这些基本的效果,还有很多效果蕴含其中....感觉分组列表的效果最难做. 我大致做出了那样的效果,很不美观.没达到一样的效果,就不分析思路了,以免误人子弟. 用的是ScrollViewer 前台: <Scr

仿QQ好友列表界面的实现

TableView有2种style:UITableViewStylePlain 和 UITableViewStyleGrouped. 但是QQ好友列表的tableView给人的感觉似乎是2个style效果都有,但是tableView不能实现2种效果同时存在. 其实只是用到了Plain这个style,只是在cell的个数显示上做了个处理(个人见解,希望可以帮到有需要的人.....) 当通讯录那一组的cell的组头视图中的button是普通状态下的时候,并不是不显示cell,而是显示一个没有任何内容