午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    分析javascript縱向的相冊(cè)效果
    來(lái)源:易賢網(wǎng) 閱讀:995 次 日期:2014-08-15 16:52:05
    溫馨提示:易賢網(wǎng)小編為您整理了“分析javascript縱向的相冊(cè)效果”,方便廣大網(wǎng)友查閱!

    本代碼來(lái)自于懶人圖庫(kù),本站只是對(duì)其代碼進(jìn)行分析并解釋,并標(biāo)注了源代碼的來(lái)源,本次是對(duì)縱向的相冊(cè)效果進(jìn)行分析.

    注明:源文件來(lái)源于懶人圖庫(kù)(便于代碼簡(jiǎn)潔,去除了部分懶人的ad)

    <!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=gb2312" />

    <title>縱向的JS相冊(cè)效果</title>

    <style>

    body {background:#000000;margin:20px 0;font:12px Verdana, Arial, Tahoma;text-align:center;vertical-align:middle;color:#FFFFFF}

    img {border:none}

    .txt_1 {font:bold 24px Verdana, Tahoma;color:#fff}

    img.thumb_img {cursor:pointer;display:block;margin-bottom:10px}

    img#main_img {cursor:pointer;display:block;}

    #gotop {cursor:pointer;display:block;}

    #gobottom {cursor:pointer;display:block;}

    #showArea {height:355px;margin:10px;overflow:hidden}

    .info {color:#666;font:normal 9px Verdana;margin-top:20px}

    .info a:link, .info a:visited {color:#666;text-decoration:none}

    .info a:hover {color:#fff;text-decoration:none}

    </style>

    </head>

    <body>

    <table width="760" border="0" align="center" cellpadding="0" cellspacing="5">

    <tr>

    <td height="75" colspan="2" align="left" class="txt_1">縱向的JS相冊(cè)效果</td><!--<網(wǎng)站制作學(xué)習(xí)網(wǎng)Foasp.cn>-->

    </tr>

    <tr>

    <td width="640" align="center"><img src="images/03.jpg" URL width="640" height="400" border="0" id="main_img" rel="images/03.jpg" link="URL" /><!--這是展示整個(gè)大圖--></td>

    <td width="110" align="center" valign="top">

    <img src="images/gotop.gif" width="100" height="14" id="gotop" /><!--上邊的按鈕-->

    <div id="showArea">

     <img src="images/01.jpg"  width="80" height="50" border="0" class="thumb_img" rel="images/01.jpg" link="URL" />

     ......省略n個(gè)圖片

     <img src="images/02.jpg"  width="80" height="50" border="0" class="thumb_img" rel="images/02.jpg" link="URL" /><!--設(shè)置rel后圖片可以有l(wèi)ink的連接,點(diǎn)擊直接跳轉(zhuǎn)-->

     

    </div>

    <img src="images/gobottom.gif" width="100" height="14" id="gobottom" /><!--下邊的按鈕--></td>

    </tr>

    </table>

    </body>

    </html>

    <script language="javascript" type="text/javascript">

    function $(e) {return document.getElementById(e);}//定義獲取通過(guò)對(duì)象

    document.getElementsByClassName = function(cl) {//定義document的通過(guò)ClassName來(lái)獲得對(duì)象數(shù)組

    var retnode = [];//定義空數(shù)組

    var myclass = new RegExp(cl);//通過(guò)正則上面?zhèn)鱽?lái)的cl值來(lái)判斷對(duì)象

    var elem = this.getElementsByTagName('*');

    for (var i = 0; i < elem.length; i++) {

     var classes = elem[i].className;//如果classname符合正則則添加到定義的空數(shù)組

     if (myclass.test(classes)) retnode.push(elem[i]);

    }

    return retnode;//最后返回?cái)?shù)組

    }

    var MyMar;

    var speed = 1; //速度,越大越慢

    var spec = 1; //每次滾動(dòng)的間距, 越大滾動(dòng)越快

    var ipath = 'images/'; //圖片路徑

    var thumbs = document.getElementsByClassName('thumb_img');//獲取以"thumb_img"的數(shù)組

    for (var i=0; i<thumbs.length; i++) {

    thumbs[i].onmouseover = function () {$('main_img').src=this.rel; $('main_img').link=this.link;};//循環(huán)對(duì)對(duì)象進(jìn)行附加事件

    thumbs[i].onclick = function () {location = this.link}

    }

    $('main_img').onclick = function () {window.open(this.link);}//對(duì)中間的大圖進(jìn)行附加事件

    $('gotop').onmouseover = function() {this.src = ipath + 'gotop2.gif'; MyMar=setInterval(gotop,speed);}

    $('gotop').onmouseout = function() {this.src = ipath + 'gotop.gif'; clearInterval(MyMar);}

    $('gobottom').onmouseover = function() {this.src = ipath + 'gobottom2.gif'; MyMar=setInterval(gobottom,speed);}

    $('gobottom').onmouseout = function() {this.src = ipath + 'gobottom.gif'; clearInterval(MyMar);}

    function gotop() {$('showArea').scrollTop-=spec;}//設(shè)定鼠標(biāo)移動(dòng)到上下按鈕時(shí),圖片的整體滾動(dòng)<網(wǎng)站制作學(xué)習(xí)網(wǎng)Foasp.cn>

    function gobottom() {$('showArea').scrollTop+=spec;}

    </script>

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看腳本欄目
    易賢網(wǎng)手機(jī)網(wǎng)站地址:分析javascript縱向的相冊(cè)效果
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2025國(guó)考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)