随机变换颜色的图片边框

Posted on 2009-09-24 12:33  萧木柯  阅读(230)  评论(0编辑  收藏  举报
<style>
body img{border:1px solid white}
</style>
<script language="JavaScript">
var color;
var i
function change(i){
var a=Math.random()*255;
var b=Math.random()*255;
var c=Math.random()*255;
color="rgb("+a+","+b+","+c+")";
var source=event.srcElement;
if (source.tagName=="IMG")
source.style.border="3px solid "+i+""
}
</script>
<body bgcolor="#FFFFFF" text="#000000" onmouseover="change(color)" onmouseout="change('white')">
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
<a href="css.htm"><img src="http://images.cnblogs.com/1.jpg" border="0" width="59" height="59"></a>
</body>