图片选中效果
求QQ中上传照片,选中照片特效效果,如图所示
最好有整个相片框的示例代码。
------解决方案--------------------<!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 type="text/css">
*{margin:0;padding:0;}
body{font-size:12px;}
ul{list-style:none;}
#imgbox{width:450px;margin:100px auto; overflow:hidden;zoom:1;}
#imgbox ul li{width:120px; height:100px; float:left; margin-right:10px; margin-bottom:10px; border:1px solid #fff; padding:30px 2px; cursor:pointer;}
#imgbox ul li img{width:120px; height:100px;}
#imgbox ul li.current{border:1px solid #5d90ab; background:url(images/ok.jpg) 0 0 no-repeat;}
</style>
<script type="text/javascript">
window.onload=function(){
var oDiv = document.getElementById('imgbox');
var oUl = oDiv.getElementsByTagName('ul')[0];
var oLi = oUl.getElementsByTagName('li');
for(var i = 0; i<oLi.length; i++){
oLi[i].onclick=function(){
/* for(var i = 0; i<oLi.length; i++){
oLi[i].className='';
}*/
this.className='current';
}
}
}
</script>
</head>
<body>
<div id="imgbox">
<ul>
<li><img src="images/1.jpg" /></li>
<li><img src="images/2.jpg" /></li>
<li><img src="images/3.jpg" /></li>
<li><img src="images/4.jpg" /></li>
<li><img src="images/5.jpg" /></li>
<li><img src="images/6.jpg" /></li>
</ul>
</div>
</body>
</html>