當前位置:開發者網絡 >> 網頁特效 >> 圖形圖像 >> 內容
精彩推薦
分類最新特效
分類熱點特效
   
圖片響應鼠標變換
日期: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>