首页 > 代码库 > 当鼠标经过换一张相片

当鼠标经过换一张相片

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title>当鼠标经过换一张相片</title>
    <meta name="keywords" content="关键字列表" />
    <meta name="description" content="网页描述" />
    <link rel="stylesheet" type="text/css" href="" />
    <style type="text/css"></style>
    <script type="text/javascript"></script>
</head>
<body>

</body>
</html>
    <img src="jd1.png" id="img1">    
    <script type="text/javascript">
        var imgObj=document.getElementById("img1");//对象.属性=(""),对象.方法("")
        imgObj.onmouseover=function(){
        imgObj.src="jd2.png"                    
        }
        imgObj.onmouseout=function(){
        imgObj.src="jd1.png"                
        }
      
    </script>

技术分享技术分享

 

当鼠标经过换一张相片