html js 边框 颜色 特效 – 青春部落,流年似水 http://www.youthtribe.com 青春是一场远行,总记不起来时的路。 Thu, 19 Apr 2012 14:50:44 +0000 zh-CN hourly 1 https://wordpress.org/?v=6.1.7 html js 边框 颜色 特效 – 青春部落,流年似水 http://www.youthtribe.com/archives/581 http://www.youthtribe.com/archives/581#respond Thu, 19 Apr 2012 14:50:44 +0000 http://www.youthtribe.com/?p=581 找到了一个当鼠标移动到当前元素时,当前元素可以随机显示一个边框颜色,效果非常不错!

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>无标题文档</title>
<style>
img{border:3px solid white}
</style>
<SCRIPT language=JavaScript>
function change(){
var a=Math.random()*255;
var b=Math.random()*255;
var c=Math.random()*255;
var color=”rgb(“+a+”,”+b+”,”+c+”)”;
if(event.type==”mouseover”)
{
if (event.srcElement.tagName==”IMG”)
event.srcElement.style.border=”3px solid “+color
}
if(event.type==”mouseout”)
{
if (event.srcElement.tagName==”IMG”)
event.srcElement.style.border=”3px solid white”
}
}
</SCRIPT>
</head>

<body>

<a href="”1.iun”&hu;μjnh" src=”1.gif” width=”200″ height=”200″  onmouseover=change() onmouseout=”change()”></a>
<a href="”2.iun”&hu;μjnh" src=”1.gif” width=”200″ height=”200″  onmouseover=change() onmouseout=”change()”></a>

</body>
</html>

]]>
http://www.youthtribe.com/archives/581/feed 0