<!DOCTYPE>
<html><head> <title></title> <style> .hostVideo{ width:208px; height:116px; border:0px solid #000; position:relative; cursor:pointer; } .hostVideoImg{ position:relative; width:100%; height:100%; } .hostImg{ width:208px; height:116px; } .hostMask{ position:absolute; left:0; top:0; width:100%; height:100%; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0); opacity:0; } .hostLonger{ position:absolute; z-indent:2; left:7px; top:91px; } .hostVideomeg2{ font-style:Tahoma; font-weight:400; color:#FFFFFF; } .hostVideomeg3{ font:Tahoma, Helvetica, sans-serif; font-size:13px; color:#B2B2B2; } .hostAdd{ z-indent:2;left:188px;top:95px; background-color:#737372; } .hostPlay{ z-indent:2;left:7px;top:85px; background-color:#737372; } .hostVideoMeg{ position:absolute;z-indent:2;left:7px;top:10px; } </style></head>
<body><h2>最热</h2>
<div class="hostVideo">
<div class="hostVideoImg">
<img src="drfIMG.jpg" class="hostImg"/> <img src="shenmask.png" class="hostMask" title="行车记录仪"/> <div class="hostLonger"> <font class="hostVideomeg2"><strong><大锅fun>歪果仁玩坏西游</strong></font><br> </div> <!-- 视频信息 --> <div style="display:none" class="hostVideoMeg"> <font class="hostVideomeg2"><strong><大锅fun>歪果仁玩坏西游</strong></font><br> <font class="hostVideomeg3">无节操上演男男“拥吻"</font><br> <font class="hostVideomeg3">1453次播放</font> </div><!-- 立即播放 -->
<div style="position:absolute;display:none" class="hostPlay"> <img src="play.png"/> </div> <!-- 添加 --> <div style="position:absolute; display:none;" class="hostAdd"> <img src="add.png"/> </div> </div></div>
<hr>
<div class="hostVideo">
<div class="hostVideoImg">
<img src="drfIMG.jpg" class="hostImg"/> <img src="shenmask.png" class="hostMask" title="行车记录仪"/> <div class="hostLonger"> <font class="hostVideomeg2"><strong><大锅fun>歪果仁玩坏西游</strong></font><br> </div> <!-- 视频信息 --> <div style="display:none" class="hostVideoMeg"> <font class="hostVideomeg2"><strong><大锅fun>歪果仁玩坏西游</strong></font><br> <font class="hostVideomeg3">无节操上演男男“拥吻"</font><br> <font class="hostVideomeg3">1453次播放</font> </div><!-- 立即播放 -->
<div style="position:absolute;display:none" class="hostPlay"> <img src="play.png"/> </div> <!-- 添加 --> <div style="position:absolute; display:none" class="hostAdd"> <img src="add.png"/> </div> </div></div>
<script type="text/javascript">var hostVideo = document.getElementsByClassName("hostVideo");var hostMask = document.getElementsByClassName("hostMask");var hostLonger = document.getElementsByClassName("hostLonger");var hostAdd = document.getElementsByClassName("hostAdd");var hostPlay = document.getElementsByClassName("hostPlay");var hostVideoMeg = document.getElementsByClassName("hostVideoMeg");for(var i=0;i<hostVideo.length;i++){
/* 之所以用到闭包,原因是:内部函数在使用外部变量时使用引用的方式,其实相当于java中的引用传递,而非值传递。传递进来的引用只相当于一个指针,指向的是一个内存地址,这个内存地址存放的才是具体的值,而外面的循环会不断的修改这个存放地址中的值,所以最后循环结束之后,参数的值只能找到最后一个。 */ (function(){ var p = i; hostVideo[p].onmouseover = function() { hostLonger[p].style.display = "none"; hostAdd[p].style.display = ""; hostPlay[p].style.display = ""; hostVideoMeg[p].style.display = ""; hostMask[p].style.opacity = "1"; hostMask[p].style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=50)" } hostVideo[p].onmouseout = function() { hostLonger[p].style.display = ""; hostAdd[p].style.display = "none"; hostPlay[p].style.display = "none"; hostVideoMeg[p].style.display = "none"; hostMask[p].style.opacity = "0"; hostMask[p].style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)" } })(); }</script>
</body>
</html>