当前位置:开发者网络 >> 网页特效 >> 图形图象 >> 内容
精彩推荐
分类最新特效
分类热点特效
  
图片响应鼠标变换
日期:2004-06-30   人气:   【字体: 】【收藏此文


<!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! -->
<!-- 要实现此效果需要 2 个步骤: -->

<!-- 第 1 步: -->
<!-- 把<BODY>中的属性代码改为: -->

<BODY bgcolor="#fef4d9">



<!-- 第 2 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<center>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var rand1 = 0;
var useRand = 0;

images = new Array;
images[1] = new Image();
images[1].src = "images/webasp.net.1.jpg";
images[2] = new Image();
images[2].src = "images/webasp.net.2.jpg";
images[3] = new Image();
images[3].src = "images/webasp.net.3.jpg";
images[4] = new Image();
images[4].src = "images/webasp.net.4.jpg";


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="http://www.webasp.net/js/images/webasp.net.1.jpg"></a><br>
<font face="Verdana" size="-2">click image to change</font>
</center>