js滑鼠滑動圖片顯示隱藏效果

來源:互聯網
上載者:User

標籤:des   style   blog   http   color   io   os   java   ar   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>    <head>        <!--聲明當前頁面的編碼集charset=gbk中文編碼gb2312,charset=utf-8國際編碼-->        <meta http-equiv="Content-Type" content="text/html; charset=gbk">        <!--當前頁面的三要素-->        <title>js滑動圖片顯示和隱藏效果</title>        <meta name="Keywords" content="js滑動,圖片顯示">        <meta name="description" content="描述">            <!--css 內部樣式 , js-->            <style type="text/css">            *{margin:0px; padding:0px;}            /*屬性:值; width:300px; 像素 */            #News{width:300px; height:305px;border:1px solid #ddd;            margin:50px auto;}            /*list-style-type:none; 去掉前面的圓點*/            #News ul li{list-style-type:none;padding:0px 10px 0px 10px;}            #News ul li a{color:#2d2d2d; font-family:"微軟雅黑";font-size:14px; text-decoration:none;/*去掉底線*/}            #News ul li a:hover{color:#eb1c24;text-decoration:underline;}            #News ul li span a{color:#726168;}            #News ul li span a:hover{color:#eb1c24;}            #News ul li p{line-height:30px;}            #News ul li img{display:none;/*隱藏圖片*/}            #News ul li img.xs{display:block;/*顯示第一圖片*/}            #News ul li.bg{background:url("images/bg.png"); padding-bottom:15px;}            #News ul li span.hover a{color:#eb1c24;}                </style>    </head>    <body><!--div盒子模型,寬度,高度 放內容-->    <div id="News">        <ul>            <li class="bg">                <p><span class="hover"><a href="#">[時裝頻道]</a></span>                   <a href="#">2014秋冬巴黎時裝周</a></p>                    <img src="images/1.jpg" class="xs"/>            </li>            <li><p><span><a href="#">[男裝頻道]</a></span>                    <a href="#">穿出Street Fashion</a></p>                    <img src="images/2.jpg"/>            </li>            <li><p><span><a href="#">[時裝頻道]</a></span>                    <a href="#">2014秋冬巴黎時裝周</a></p>                    <img src="images/3.jpg"/>            </li>            <li>                <p>                    <span><a href="#">[時裝頻道]</a></span>                    <a href="#">2014秋冬米蘭時裝周</a>                </p>                    <img src="images/4.jpg"/>            </li>        </ul>    </div>    <!-- <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> --><script type="text/javascript">window.onload=function(){    var oNews = document.getElementById(‘News‘);    var oLi = oNews.getElementsByTagName(‘li‘);    var oimg = document.getElementsByTagName(‘img‘);    var ospan = document.getElementsByTagName(‘span‘);        for(var i=0;i<oLi.length;i++){        oLi[i].index=i;        oLi[i].onmouseover=function(){            for(var i=0;i<oLi.length;i++){                oLi[i].className=‘‘;                oimg[i].style.display=‘none‘;                ospan[i].className=‘‘;                            }            this.className=‘bg‘;            if(this.className=‘bg‘){                ospan[this.index].className=‘hover‘;                oimg[this.index].style.display=‘block‘;            }        }    }        }</script>    </body></html>

 

js滑鼠滑動圖片顯示隱藏效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.