你参考下:图片响应鼠标变换
第一步:把如下代码加入<body>区域中
<center>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var rand1 = 0;
var useRand = 0;images = new Array;
images[1] = new Image();
images[1].src = "image1.gif";
images[2] = new Image();
images[2].src = "image2.gif";
images[3] = new Image();
images[3].src = "image3.gif";
images[4] = new Image();
images[4].src = "image4.gif";
function swapPic() {
var imgnum = images.length - 1;
do {
var randnum = Math.random();
rand1 = Math.round((imgnum - 1) * randnum) + 1;
} while (rand1 == useRand);
useRand = rand1;
document.randimg.src = images[useRand].src;
}
//  End -->
</script>
<a onClick="swapPic();"><img name="randimg" src="image1.gif" tppabs="http://127.0.0.1/javascript/image1.gif"></a><br>
<font face="Verdana" size="-2">click image to change</font>
</center>第二步:把<body>区域中内容改为:
<body bgcolor="#fef4d9" OnLoad="swapPic()">

解决方案 »

  1.   

    <img src="http://community.csdn.net/images/top1.gif"
    onmouseover="this.src='http://community.csdn.net/images/top2.gif'"
    onmouseout="this.src='http://community.csdn.net/images/top1.gif'">
      

  2.   

    <SCRIPT>
    function zap()
      { 
       if(myimg.filters.glow.enabled==1)
         {myimg.filters.glow.enabled=0;
         }
       if (myimg.filters.blendTrans.status==0)
          {
            myimg.filters.blendTrans.apply();
            myimg.filters.glow.enabled=1;
            myimg.filters.blendTrans.play();
          }
    IMGID.src="中国的航母.jpg";
          
        }      
                  
    </SCRIPT>
    <DIV id=myimg onmouseout=zap() 
    style="FILTER: glow(color=#ffff00,strength=20,enabled=0)
          blendTrans(duration=2); FONT-SIZE: 54px; HEIGHT: 200px">
      <P><img src="中国自行火炮系列.jpg" id="IMGID"></P>
    </DIV>
      

  3.   

    <script>
    function Flash(bStatus)

    if(ImgDivID.filters.glow.enabled==1)
    {
    ImgDivID.filters.glow.enabled=0;
    }
    if(ImgDivID.filters.blendTrans.status==0)
    {
            ImgDivID.filters.blendTrans.apply();
            ImgDivID.filters.glow.enabled=1;
            ImgDivID.filters.blendTrans.play();
    }
    if(bStatus=="1")
    {
    ImgID.src="中国的航母.jpg";
    }
    else
    {
    ImgID.src="中国自行火炮系列.jpg";
    }
    }
    </script>
    <div id=ImgDivID onmouseout=Flash("1") onmouseover=Flash("0") 
    style="filter:glow(color=#ffff00,strength=20,enabled=0) blendTrans(duration=2);height:400px">
    <img src="中国自行火炮系列.jpg" id="ImgID">
    </div>
      

  4.   

    谢谢各位。wanghr100(灰豆宝宝.net)的方法简单有效,gjd111686(数字金刚)的方法也挺好,yslcuk(yl)的方法没有看懂,能不能再解释一下。
      

  5.   

    其实有些效果用HTML的就挺好,短小,容易!比如滚动字幕的功能,JS的老长,其实一个 <marquee>就很厉害了!