最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS實(shí)現(xiàn)圖片高亮展示效果實(shí)例

 更新時(shí)間:2015年11月24日 11:26:22   作者:匯賢雅敘  
這篇文章主要介紹了JS實(shí)現(xiàn)圖片高亮展示效果的方法,實(shí)例分析了JavaScript響應(yīng)鼠標(biāo)事件動(dòng)態(tài)操作頁(yè)面元素樣式的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了JS實(shí)現(xiàn)圖片高亮展示效果的方法。分享給大家供大家參考,具體如下:

昨天朋友讓我?guī)椭鰝€(gè)圖片高亮展示的效果,雖然不難,不過(guò)滿有創(chuàng)意的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>name</title>
<style type="text/css">
*{}{margin:0; padding:0;}
a img{}{border:none;}
#imagesBox {}{ width:165px; height:110px; position:relative; left:100px; top:100px; z-index:1; border:1px solid black; background-color:white;}
#trans{}{ width:165px; height:110px; position:absolute; left:0; top:0; z-index:2; display:none; opacity:0.5; filter:alpha(opacity=50); background-color:black;}
#imagesBox li {}{ width:55px; height:55px; float:left; overflow:hidden;}
#imagesBox li a,#imagesBox li img {}{ width:55px; height:55px; display:block; cursor:pointer;}
#imagesBox li img{}{ position:relative;}
#imagesBox strong{}{position:absolute;left:0; top:50%; margin-top:-7px; z-index:999; display:block; color:white; width:100%; height:15px; text-align:center; z-index:999;} 
</style>
<script type="text/javascript">
  function gallery(obj){
    var tit=obj.getAttribute("alt");  
    document.getElementById("show_tit").firstChild.nodeValue=tit;
    document.getElementById("trans").style.display='block';
    obj.style.zIndex="3";
  }
  function clearBg(obj){
    document.getElementById("show_tit").firstChild.nodeValue="";
    document.getElementById("trans").style.display='none';
    obj.style.zIndex="1";
  }
</script>
</head>
<body>
<div id="imagesBox"> 
  <ul>
  <li><a href="#" title="名稱1"><img onmouseover="gallery(this);" onmouseout="clearBg(this)" src="/images/artist//12053006018793_3.jpg" height="55" width="55" alt="名稱1"/><span></span></a></li>
  <li><a href="#" title="名稱2"><img onmouseover="gallery(this);" onmouseout="clearBg(this)" src="/images/artist//12053006018793_3.jpg" height="55" width="55" alt="名稱2"/><span></span></a></li>
  <li><a href="#" title="名稱3"><img onmouseover="gallery(this);" onmouseout="clearBg(this)" src="/images/artist//12053006018793_3.jpg" height="55" width="55" alt="名稱3"/><span></span></a></li>
  <li><a href="#" title="名稱4"><img onmouseover="gallery(this);" onmouseout="clearBg(this)" src="/images/artist//12053006018793_3.jpg" height="55" width="55" alt="名稱4"/><span></span></a></li>
  <li><a href="#" title="名稱5"><img onmouseover="gallery(this);" onmouseout="clearBg(this)" src="/images/artist//12053006018793_3.jpg" height="55" width="55" alt="名稱5"/><span></span></a></li>
  <li><a href="#" title="名稱6"><img onmouseover="gallery(this);" onmouseout="clearBg(this)" src="/images/artist//12053006018793_3.jpg" height="55" width="55" alt="名稱6"/><span></span></a></li>
 </ul>
<div id="trans">&nbsp;</div>
<strong id="show_tit">&nbsp;</strong>
</div>
</body>
</html>

剛開(kāi)始因?yàn)闆](méi)有完全明白設(shè)計(jì)意圖,陰差陽(yáng)錯(cuò)的做了個(gè)這樣的效果:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>name</title>
<style type="text/css">
*{margin:0; padding:0;}
a img{border:none;}
#imagesBox { width:165px; height:100px; position:relative; left:100px; top:100px;}
#imagesBox li { width:55px; height:55px; float:left; overflow:hidden; position:relative;}
#imagesBox li img { width:55px; height:55px; position:relative; z-index:2; }
#imagesBox li span { line-height:100px; background:#000; position:absolute; top:0; left:0; z-index:3; opacity:0.5; filter:alpha(opacity=50); 
display:block; width:55px; height:55px;}
#imagesBox li a:hover span{display:none;} 
#imagesBox strong{position:absolute;left:0; top:50%; margin-top:-7px; z-index:999; display:block; color:white; width:100%; height:15px; text-
align:center;} 
</style>
<script type="text/javascript">
  function gallery(obj){
    var tit=obj.getAttribute("title");  
    document.getElementById("show_tit").firstChild.nodeValue=tit;
    document.getElementById("imagesBox").onmouseout=function(){document.getElementById("show_tit").firstChild.nodeValue="這里顯示
名字"};
  }
</script>
</head>
<body>
<div id="imagesBox">
 <ul>
  <li><a href="#" onmouseover="gallery(this);" title="名稱1"><img src="/images/artist//12053006018793_3.jpg" height="55" 
width="55" alt="名稱1"/><span></span></a></li>
  <li><a href="#" onmouseover="gallery(this);" title="名稱2"><img src="/images/artist//12053006018793_3.jpg" height="55" 
width="55" alt="名稱2"/><span></span></a></li>
  <li><a href="#" onmouseover="gallery(this);" title="名稱3"><img src="/images/artist//12053006018793_3.jpg" height="55" 
width="55" alt="名稱3"/><span></span></a></li>
  <li><a href="#" onmouseover="gallery(this);" title="名稱4"><img src="/images/artist//12053006018793_3.jpg" height="55" 
width="55" alt="名稱4"/><span></span></a></li>
  <li><a href="#" onmouseover="gallery(this);" title="名稱5"><img src="/images/artist//12053006018793_3.jpg" height="55" 
width="55" alt="名稱5"/><span></span></a></li>
  <li><a href="#" onmouseover="gallery(this);" title="名稱6"><img src="/images/artist//12053006018793_3.jpg" height="55" 
width="55" alt="名稱6"/><span></span></a></li>
 </ul>
 <strong id="show_tit">這里顯示名字</strong>
</div>
</body>
</html>

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • 如何快速的呈現(xiàn)我們的網(wǎng)頁(yè)的技巧整理

    如何快速的呈現(xiàn)我們的網(wǎng)頁(yè)的技巧整理

    如何快速的呈現(xiàn)我們的網(wǎng)頁(yè)的技巧整理...
    2007-07-07
  • 我遇到的參數(shù)傳遞中 雙引號(hào)單引號(hào)嵌套問(wèn)題

    我遇到的參數(shù)傳遞中 雙引號(hào)單引號(hào)嵌套問(wèn)題

    我遇到的參數(shù)傳遞中 雙引號(hào)單引號(hào)嵌套問(wèn)題
    2010-02-02
  • javascript 廣告移動(dòng)特效的實(shí)現(xiàn)代碼

    javascript 廣告移動(dòng)特效的實(shí)現(xiàn)代碼

    下面小編就為大家?guī)?lái)一篇javascript 廣告移動(dòng)特效的實(shí)現(xiàn)代碼。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-06-06
  • 整理CocosCreator常用知識(shí)點(diǎn)

    整理CocosCreator常用知識(shí)點(diǎn)

    這篇文章主要介紹了整理CocosCreator常用知識(shí)點(diǎn),這些知識(shí)點(diǎn),平時(shí)幾乎都能用到,希望同學(xué)們看完后,可以自己去試一下,加深印象
    2021-04-04
  • JS對(duì)象序列化成json數(shù)據(jù)和json數(shù)據(jù)轉(zhuǎn)化為JS對(duì)象的代碼

    JS對(duì)象序列化成json數(shù)據(jù)和json數(shù)據(jù)轉(zhuǎn)化為JS對(duì)象的代碼

    這篇文章主要介紹了JS對(duì)象序列化成json數(shù)據(jù)和json數(shù)據(jù)轉(zhuǎn)化為JS對(duì)象的代碼,需要的朋友可以參考下
    2017-08-08
  • 最新評(píng)論

    北宁市| 辉县市| 晋宁县| 西丰县| 五莲县| 长丰县| 抚远县| 溆浦县| 潍坊市| 广昌县| 福鼎市| 鸡西市| 财经| 浪卡子县| 澳门| 龙州县| 织金县| 乐山市| 涡阳县| 教育| 常宁市| 苏尼特左旗| 甘德县| 桂林市| 临汾市| 威远县| 朔州市| 石首市| 德令哈市| 益阳市| 石景山区| 聂荣县| 铁力市| 公安县| 个旧市| 张北县| 岱山县| 丰台区| 通化市| 南城县| 天门市|