導航:首頁 > 萬維百科 > 網頁設計滑鼠觸碰時變色代碼

網頁設計滑鼠觸碰時變色代碼

發布時間: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]++;
}
}

與網頁設計滑鼠觸碰時變色代碼相關的知識