鼠标悬停 DIV淡入淡出
如题:给出代码:<html><head><styletype="text/css">body{overflow-x:hidden;overflow-y:auto;marg...
如题:
给出代码:
<html>
<head>
<style type="text/css">
body{overflow-x:hidden;
overflow-y:auto;margin:0px; cursor:default; background:#000;}
.b1{
background:#000;
background-image:url(images/1.jpg);
background-repeat: no-repeat;}
.b2{background:#000;
background-image:url(images/2.jpg);
background-repeat: no-repeat;}
.b3{background:#000;
background-image:url(images/3.jpg);
background-repeat: no-repeat;}
.b4{background:#000;
background-image:url(images/4.jpg);
background-repeat: no-repeat;}
.b5{background:#000;
background-image:url(images/5.jpg);
background-repeat: no-repeat;}
#codefans_net{
height:693px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<div id=xp class="b1">
<div id="codefans_net">
<table width="97%" style="float:left; text-align:right; margin-top:18px; margin-left:6px;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="#"><img border="0" alt="USA" src="images/g1.jpg"/></a>
<a href="#"><img border="0" alt="English" src="images/g2.jpg"/></a>
<a href="#"><img border="0" alt="China" src="images/g3.jpg"/></a>
<a href="#"><img border="0" alt="Italian" src="images/g4.jpg"/></a>
<a href="#"><img border="0" alt="Spanish" src="images/g5.jpg"/></a>
<a href="#"><img border="0" alt="Russian" src="images/g6.jpg"/></a>
<a href="#"><img border="0" alt="French" src="images/g7.jpg"/></a>
</td>
</tr>
</table>
<table width="97%" style="float:left; text-align:right; margin-top:325px; margin-left:26px;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/zw.gif" border="0" usemap="#Map"/></td>
</tr>
</table>
</div>
</div>
<map name="Map">
<area shape="rect" style="cursor:pointer;" coords="264,184,334,199" href="#"
onMouseOver="document.getElementById('xp').className='b2'"
>
<area shape="rect" coords="343,184,435,199" href="#"
onMouseOver="document.getElementById('xp').className='b3'">
<area shape="rect" coords="444,184,541,198" href="#"
onMouseOver="document.getElementById('xp').className='b4'">
<area shape="rect" coords="550,184,620,198" href="#"
onMouseOver="document.getElementById('xp').className='b5'">
</map>
</body>
</html>
<area shape="rect" style="cursor:pointer;" coords="264,184,334,199" href="#"
onMouseOver="document.getElementById('xp').className='b2'">
这里鼠标悬停的时候,id为xp,class='b2'的div淡入. 展开
给出代码:
<html>
<head>
<style type="text/css">
body{overflow-x:hidden;
overflow-y:auto;margin:0px; cursor:default; background:#000;}
.b1{
background:#000;
background-image:url(images/1.jpg);
background-repeat: no-repeat;}
.b2{background:#000;
background-image:url(images/2.jpg);
background-repeat: no-repeat;}
.b3{background:#000;
background-image:url(images/3.jpg);
background-repeat: no-repeat;}
.b4{background:#000;
background-image:url(images/4.jpg);
background-repeat: no-repeat;}
.b5{background:#000;
background-image:url(images/5.jpg);
background-repeat: no-repeat;}
#codefans_net{
height:693px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<div id=xp class="b1">
<div id="codefans_net">
<table width="97%" style="float:left; text-align:right; margin-top:18px; margin-left:6px;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="#"><img border="0" alt="USA" src="images/g1.jpg"/></a>
<a href="#"><img border="0" alt="English" src="images/g2.jpg"/></a>
<a href="#"><img border="0" alt="China" src="images/g3.jpg"/></a>
<a href="#"><img border="0" alt="Italian" src="images/g4.jpg"/></a>
<a href="#"><img border="0" alt="Spanish" src="images/g5.jpg"/></a>
<a href="#"><img border="0" alt="Russian" src="images/g6.jpg"/></a>
<a href="#"><img border="0" alt="French" src="images/g7.jpg"/></a>
</td>
</tr>
</table>
<table width="97%" style="float:left; text-align:right; margin-top:325px; margin-left:26px;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/zw.gif" border="0" usemap="#Map"/></td>
</tr>
</table>
</div>
</div>
<map name="Map">
<area shape="rect" style="cursor:pointer;" coords="264,184,334,199" href="#"
onMouseOver="document.getElementById('xp').className='b2'"
>
<area shape="rect" coords="343,184,435,199" href="#"
onMouseOver="document.getElementById('xp').className='b3'">
<area shape="rect" coords="444,184,541,198" href="#"
onMouseOver="document.getElementById('xp').className='b4'">
<area shape="rect" coords="550,184,620,198" href="#"
onMouseOver="document.getElementById('xp').className='b5'">
</map>
</body>
</html>
<area shape="rect" style="cursor:pointer;" coords="264,184,334,199" href="#"
onMouseOver="document.getElementById('xp').className='b2'">
这里鼠标悬停的时候,id为xp,class='b2'的div淡入. 展开
1个回答
展开全部
你的例子不太好试,简单来说淡入淡出就是需要用setInterval不停改变图片的alpha值。我这里有个例子,你试试就知道了。
<html>
<head>
</head>
<body>
<script language="JavaScript1.2">
<!--
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",65)
}
function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=65
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
}
//-->
</script>
<img onmouseover="high(this)" style="Cursor:hand; FILTER: alpha(opacity=65)" onmouseout="low(this)" hspace="0" src="mm.jpg" border="0">
</body>
</html>
<html>
<head>
</head>
<body>
<script language="JavaScript1.2">
<!--
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",65)
}
function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=65
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
}
//-->
</script>
<img onmouseover="high(this)" style="Cursor:hand; FILTER: alpha(opacity=65)" onmouseout="low(this)" hspace="0" src="mm.jpg" border="0">
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询