导航:首页 > 万维百科 > 网页设计鼠标触碰时变色代码

网页设计鼠标触碰时变色代码

发布时间:2020-12-18 16:09:56

1、谁知道如何实现鼠标停留,变色代码?如果是程序

加入下面的CSS
.style1:hover
{bgcolor:
#FF00FF}
然后你要变色的HTML标签设置上class="style1"就可以了

2、当鼠标移过文本改变并且变色的网页代码怎么写

编写href的属性就可以实现,具体的自己去查

3、网页制作javascript鼠标经过文字变色问题

<style type="text/css">
body,td,th {
font-size: 18px;
color: #999;
font-weight: bold;
}

上面已经设置了td,th文字颜色属性,

<td width="62"><div align="center"><a href=page1.html style="color='#999';cursor:hand" onmouseover="javascript:this.style.color='red'" 
onmouseout="javascript:this.style.color='#999'">游戏介绍</a></div></td>

这里又设置了颜色属性,不过行内样式优先,可以改成style="color=blue;............",这时即:

<style type="text/css">
body,td,th {
font-size: 18px;
color: #999;
font-weight: bold;
}<td width="62"><div align="center"><a href=page1.html style="color='blue';cursor:hand" onmouseover="javascript:this.style.color='red'" 
onmouseout="javascript:this.style.color='#999'">游戏介绍</a></div></td>

这时颜色body,td,thcolor属性已经不起作用了也可以下面这样,去掉行内style="color:#999",行内的color属性去掉 前边color设置成你要的其实颜色。

<style type="text/css">
body,td,th {
font-size: 18px;
color: blue;
font-weight: bold;
}
<td width="62"><div align="center"><a href=page1.html style="cursor:hand" onmouseover="javascript:this.style.color='red'" 
onmouseout="javascript:this.style.color='#999'">游戏介绍</a></div></td>

有点乱,希望有帮助!

4、html鼠标滑过 文字变色 求最简单的方法!!

实现鼠标经过背景变色的方法有很多,
方法一:直接写在HTML代码中。
<div onmouseover="this.style.color='red'" onmouseout="this.style.color='black'">
html鼠标滑过 文字变色
</div>

方法二:先设置固定的样式,然后调用。

<style>
.d_over{background-color:#307172;}
.d_out{background-color:#EFEFEF;}
</style>

<div class="d_out" onmouseover="this.className='d_over'"
onmouseout="this.className='d_out'">哈哈哈哈哈</div>
方法三、使用<a>标签。这也是常用的方式

一般<a>是用来定义链接的样式的,并不是定义某个区域的。现在常用的div+css的网页用,div就是表示区域的意思,还是喜欢用这种,当然用table的话,会有更简单的方法。

其实现在用的较多的是用<a>标签实现的。

<style>
a {color:red;
width:100px; height:22px; line-height:22px;}
a:hover {background:#f4f4f4;
color:#000;}
</style>

这样只要是代连接的都会变哦,你可以在某区域用,则某区域里面的所有来连接的都会鼠标经过变色。
也可以直接对一个区域的a标签写独立的样式。
例如:
<div class="bs">
<a>鼠标划过变由红变黑</a></div>
css中 设置:
.bs a {color:red; width:100px; height:22px; line-height:22px;}
.bs a:hover {background:#f4f4f4; color:#000;}
这样,就不影响其他的a标签。

5、网页制作中 当鼠标放在button按钮上时 按钮颜色改变 如何实现?

插入代码<button onmouseover="this.style.backgroundColor='red';" onmouseout="this.style.backgroundColor='';" >button</button>即可实现。

6、网页代文字鼠标经过时改变颜色或有下划线代码 谢各位了

<style>
.title {text-decoration:none; color:blue;}
.title:hover {text-decoration:underline; color:red;}
</style>

<a href='你的网址' class=title>连接名来称</a>

假设链接是蓝色自的没有下划线,鼠标放上面就变成红色,有下划线。你可以这样写。
如果你希望所有链接都这样,就改成:

<style>
a {text-decoration:none; color:blue;}
a:hover {text-decoration:underline; color:red;}
</style>

<a href='你的网址'>连接名称</a>

7、网页制作中,鼠标经过超链接部分,设置单元格部分变色的代码是什么?

a:active {
color: #FF0000;
}
把这个#FF0000 换成你想要的颜色就行了

8、网页制作鼠标经过变色

<html>
<head><title>鼠标经过链接文字变色</title>
</head>
<body>
<a href=http://www.acbi.com.cn/ style="color='red';cursor:hand" onmouseover="javascript:this.style.color='yellow'"
onmouseout="javascript:this.style.color='red'">鼠标经过链接文字变色</a>
</body>
</html>

这个是鼠标经过文字时,文字变色的代码,希望能帮到你

9、网页中当鼠标经过时,字体变色的代码?

onMouseOver=this.style.backgroundColor='#DCECF4'; onMouseOut=this.style.backgroundColor=''
随便套用:
<tr onMouseOver=this.style.backgroundColor='#DCECF4'; onMouseOut=this.style.backgroundColor=''>

<td onMouseOver=this.style.backgroundColor='#DCECF4'; onMouseOut=this.style.backgroundColor=''>

<a onMouseOver=this.style.backgroundColor='#DCECF4'; onMouseOut=this.style.backgroundColor=''>xxxxxxx</a>

10、求这个网页上的鼠标触碰效果代码

你把这个网页保存了 会有一个叫 异世界之虹.files 的文件夹 在此文件夹下有一个叫 menu2.files 的文件 里面有个js文件 那就是跳动效果的js代码

里面的代码:(解释乱码 我打开就那样 )

var bl_user = navigator.userAgent;
var bl_ver = navigator.appVersion;
var bl_name = navigator.appName;
var bl_id = 0;

if(bl_name.indexOf('Internet Explorer') >= 0)
{
if(bl_ver.charAt(0) >= 4)
{
bl_id = 1;
}
}

//////////////////////////
//////////////////////////

var hairetu = 65;
var mhairetu = hairetu - 1;

var wariai = 5;
var wariaiTmp = 0;
var wariaiNow = 0;

var i; // 棊逼傞咱偲嫟桳偟偰杰偡丅
var g_nLinkCount;

var g_NowID = 0; // 崱咱俬俢奿摆
var g_aThis = Array(hairetu); // this 亿僀儞伪奿摆
var g_ahStop = Array(hairetu); // setInterval()
var g_aPhase = Array(hairetu); // 僼僃乕僘奿摆
var g_bFlg = true; // 棊逼张栋侦擖偭偨侪儞僋偑偁傞偐偄丠
var g_nBreak = 0; // 棊逼偨悢丅
var g_Count = 0; // 尰嵼咱僀仪儞僩咱悢

/////////////////////////// 偼偠傔侦丄偙咱娭悢傪屇傃弌偦偆侓
function jmplink()
{
if(bl_id != 1) return 1; // IE 埲奜偼偝傛偆侧傜乣 (T^T)/~

g_nLinkCount = document.links.length;

for(i = 0; i < hairetu; i++)
{
g_aPhase[i] = 0;
}

for(i = 0; i < g_nLinkCount; i++)
{
document.links[i].style.position = "relative";
document.links[i].onmouseover = jump; // Link 侦 onMouseOver 咱婡擞傪捛壛偡傞侦伞丅
document.links[i].Flg = false;
}
}

function jump()
{
if(g_Count > 64 && this.Flg) return 0;

g_Count++;
g_aThis[g_NowID] = this.style;
g_ahStop[g_NowID] = setInterval("jumpProc(" + g_NowID + ")",50);

g_NowID = ++g_NowID % mhairetu;
}

function jumpProc(id)
{
switch(g_aPhase[id])
{
case 0:
case 4:
case 7:
{
g_aThis[id].top = "-2px";
}
break;
case 1:
case 3:
{
g_aThis[id].top = "-3px";
}
break;
case 2:
{
g_aThis[id].top = "-4px";
}
break;
case 5:
case 9:
case 11:
{
g_aThis[id].top = "0px";
}
break;
case 6:
case 8:
case 10:
{
g_aThis[id].top = "-1px";
}
break;
default:
{
alert(g_aPhase[id]);
}
}

if(g_aPhase[id] == 11)
{
clearInterval(g_ahStop[id]);
g_aPhase[id] = 0;
g_Count--;
}
else
{
g_aPhase[id]++;
}
}

与网页设计鼠标触碰时变色代码相关的知识