<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{
margin:0px auto;
padding:0px;
}
#da{
width:100%;
height:280px;
}
.xiao{
width:100px;
height:20px;
background-color:#00F;
border:1px solid #FFF;
text-align:center;
line-height:20px;
vertical-align:middle;
color:#FFF;
}
.xiao:hover{
cursor:pointer;
}
</style>
</head> <body>
<div id="da">
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张海军</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张琦伟</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张胜国</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">继文楷</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张三</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">李四</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">王五</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">猎人但</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">狗剩</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">王八蛋</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">狗屎</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">滚蛋</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">哈喽</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">凯奇</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张海军</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张琦伟</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张胜国</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">继文楷</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">张三</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">李四</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">王五</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">猎人但</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">狗剩</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">王八蛋</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">狗屎</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">滚蛋</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">哈喽</div>
<div class="xiao" onclick="Dian(this)" onmousemove="Fang(this)">凯奇</div>
</div>
</body>
<script type="text/javascript">
function Dian(a)
{
var xiao=document.getElementsByClassName("xiao")
for(var i=0; i<xiao.length;i++)
{
xiao[i].removeAttribute("bs")
xiao[i].style.backgroundColor="#00F"
}
a.setAttribute("bs",1);
a.style.backgroundColor="red";
}
function Fang(b)
{
var xiao=document.getElementsByClassName("xiao")
for(var i=0; i<xiao.length;i++)
{
if(xiao[i].getAttribute("bs")!="1")
{
xiao[i].style.backgroundColor="#00F"
}
}
b.style.backgroundColor="red";
}
</script>

js选中变色,不选中鼠标放上变色的更多相关文章

  1. 抽屉head部分,hover应用,鼠标放上变色

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. css 鼠标移动到按钮图片改变;图片换层;鼠标放上透明度改变直到隐藏;

    css 鼠标移动到按钮图片改变: 方法一: <style> .pp a { width:575px; height:157px; background:url(1.jpg);/*图片地址* ...

  3. 点击图片或者鼠标放上hover .图片变大. 1)可以使用css中的transition, transform 2) 预先设置一个 弹出div. 3)弹出层 alert ; 4) 浏览器的宽度document.documentElement.clientWidth || document.body.clientWidth

    变大: 方法一: 利用css属性. 鼠标放上 hover放大几倍. .kecheng_02_cell_content img { /*width: 100px; height: 133px;*/ wi ...

  4. 鼠标放上时显示隐藏的div或者其他代码的“jquery”的三种写法和“JavaScript”的一种写法

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. 动态创建div(鼠标放上显示二维码)

    最近的微信大行其道.各个网站上都给出的微信验证码,进行手机扫描加入. 怎么创建类似与点击鼠标弹出一个浮动的div显示二维码的这种效果. 1.首先制作好这样的图片,写css样式 <style ty ...

  6. td里的内容宽度自适应 及 鼠标放上显示标题div title

    td里的内容自适应宽度, 用 width:100%控制 strRight+="<td bordercolor='#DEDEDE' width='500px' height='50px' ...

  7. easyui 单元格超出鼠标放上弹出全部

    其他方式:https://www.cnblogs.com/raitorei/p/9878192.html onLoadSuccess : function(data) { //单元格超出部分隐藏并鼠标 ...

  8. jq div鼠标放上、离开马上展开、收缩方法

    <body> <div id="aa" style="width:500px; height:30px; border:1px solid #000&q ...

  9. 用CSS做长度超过长度显示‘...’,当鼠标放上时显示全部内容

    <!DOCTYPE html> <html> <head> <meta name="author" content="Yeeku ...

随机推荐

  1. 使用CSS选择器实现选择指定子节点

    HTML CSS 具体效果 其他事例 事例图片来自MDN:https://developer.mozilla.org/zh-CN/docs/Web/CSS/:nth-child

  2. [LeetCode] Random Point in Non-overlapping Rectangles 非重叠矩形中的随机点

    Given a list of non-overlapping axis-aligned rectangles rects, write a function pick which randomly ...

  3. ActivityRouter 框架简单实用

    ActivityRouter组件化开发小助手用法如下: 跟目录build.gradle dependencies { // activityRouter classpath 'com.neenbeda ...

  4. jdbc的入门学习

    一.JDBC相关概念介绍 1.1.数据库驱动 这里的驱动的概念和平时听到的那种驱动的概念是一样的,比如平时购买的声卡,网卡直接插到计算机上面是不能用的,必须要安装相应的驱动程序之后才能够使用声卡和网卡 ...

  5. JMter随记

    线程组( Threads (Users))理解:一个虚拟用户组,线程组内线程数量在运行过程中不会发生改变. 注意事项:线程间变量相互独立. 一个测试计划内可以包含多个线程组. 可定义内容: 取样器错误 ...

  6. C语言企业级的需要学习的知识

    建立正确程序运行内存的布局图(印象图) 内存四区模型图: 函数调用模型图: 数据类型的本质:固定大小内存块的别名 对于数组变量b[10]; b+1,与&b+1结果不一样: b代表的是数组首元素 ...

  7. dtFindNearestPolyQuery :: process

    dtFindNearestPolyQuery :: process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count ...

  8. corefx 源码学习:SqlClient 是如何同步建立 Socket 连接的

    在昨天的技术周会上发现 EnyimMemcached 中建立 Socket 连接的代码有问题,今天坐车的时候在手机上阅读 .net core 2.2 的 SqlClient 中同步建立 Socket ...

  9. Codeforces 1154D - Walking Robot - [贪心]

    题目链接:https://codeforces.com/contest/1154/problem/D 题解: 贪心思路,没有太阳的时候,优先用可充电电池走,万不得已才用普通电池走.有太阳的时候,如果可 ...

  10. docker安装,err:exit status 255,提示找不到虚拟机IP

    我遇到这个问题是因为,BIOS没有打开虚拟化技术,导致虚拟机无法成功创建,自然找不到IP. 解决: 1.进入BIOS,高级选项卡下,找到虚拟化技术开关,打开即可.具体做法,可搜网文. 2.删除原来自动 ...