html指针移动时变色,案例一 鼠标经过事件,变色 移动

一. 鼠标经过字体内容和背景变色

二.例:

饿哦

额,额,额

取想想天哥

博毛福禄寿

红草拨清波

var z=document.getElementsByClassName('zi')[0];

//       console.log(z);

z.οnmοuseοver=function(){

z.style.color='cyan';

document.body.style.background='pink';

}

z.οnmοuseοut=function(){

z.style.color='orange';

document.body.style.background='purple';

}

二.输入框内容点击按钮移动到另一个输入框

例:

Document

select{width:100px;height:85px;}

div{display:inline-block;width:50px}

Argentina

Brazil

Canada

Chile

China

Cuba

Denmark

Egypt

France

Greece

Spain

>>

>

<

<<

var ar=[],se=[];

ar=unsel.innerHTML.replace(/\s+/,'')

.slice(8,-13)

.split(/\s*

console.log(ar);

function move(bt){

switch(bt.innerHTML){

case '>>':

se=se.concat(ar);

ar=[];

break;

case '>':

case '

case '<

ar=ar.concat(se);

se=[];

break;

}

update(ar,unsel);

update(se,sel);

}

function update(arr,sel){

sel.innerHTML=''+arr.join('')+'';

}

一.导航

例:

Document

*{

margin: 0;

padding: 0;

list-style: none;

}

ul{

width:1200px;

height: 50px;

float: left;

line-height: 50px;

background: cyan;

margin: 0 auto;

}

li{

float: left;

width: 100px;

}

a{

width: 100px;

text-align: center;

text-decoration: none;

display: inline-block;

color:white;

}

var se=document.querySelectorAll('ul>li');

for(var i=0;i

se[i].οnmοuseοver=function(){

this.firstElementChild.style.color='cyan';

this.style.background='white';

}

se[i].οnmοuseοut=function(){

this.firstElementChild.style.color='white';

this.style.background='cyan';

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值