JS onmouseover鼠标事件:鼠标移到小图显示大图


<html>
    <head>
        <meta charset="UTF-8">
        <title>title>
        <style type="text/css">
            #goods>div>img{
                border:1px solid #ccc;
            }
            #goods>div ul li{list-style: none;float: left;}
        style>

        <script type="text/javascript">
            window.onload=function(){
                var div=document.getElementById("goods_img");
                var arr_img=div.getElementsByTagName("img");
                for(var i=0;ifunction(){
                        var bigimg=document.getElementById("bigimg");
                        var p=this.src;
                        bigimg.src=p.replace(".jpg","_big.jpg");
                    }
                }
            }
        script>
    head>
    <body>
        <div id="goods">
            <div>
                <img src="image/show1_big.jpg" id="bigimg"/>
            div>
            <div id="goods_img">
                <ul>
                    <li><img src="image/show1.jpg"/>li>
                    <li><img src="image/show2.jpg"/>li>
                    <li><img src="image/show3.jpg"/>li>
                    <li><img src="image/show4.jpg"/>li>
                    <li><img src="image/show5.jpg"/>li>
                ul>
            div>
        div>
    body>
html>

JS onmouseover鼠标事件:鼠标移到小图显示大图_第1张图片

你可能感兴趣的:(JS事件-鼠标事件)