JS淘宝浏览商品
2024-09-06 19:37:19
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>相册</title>
<style>
*{
margin:0;
padding:0;
}
ul{
list-style: none;
overflow: hidden;
}
ul li{
float: left;
width: 55px;
height: 40px;
margin-top: 10px;
margin-left: 10px;
border: 2px solid #fff;
}
ul li.active{
border-color: red;
}
</style>
</head>
<body>
<img src="img/1.jpeg" id="img">
<ul>
<li>
<a href="">
<img src="img/1.jpeg" width="55px" height="40px" class="small">
</a>
</li>
<li>
<a href="">
<img src="img/2.jpeg" width="55px" height="40px" class="small">
</a>
</li>
<li>
<a href="">
<img src="img/3.jpeg" width="55px" height="40px" class="small">
</a>
</li>
<li>
<a href="">
<img src="img/4.jpeg" width="55px" height="40px" class="small">
</a>
</li>
</ul>
<script>
var big=document.getElementById('img');
var small=document.getElementsByClassName('small');
for(var i=0;i<small.length;i++)
{
small[i].onmouseover=function()
{
for(var j=0;j<small.length;j++)
{
small[j].parentNode.parentNode.setAttribute('class','');
}
var smalls=this.getAttribute('src');
big.setAttribute('src',smalls);
this.parentNode.parentNode.setAttribute('class','active');
}
}
</script>
</body>
</html>
最新文章
- Struts2 源码分析——调结者(Dispatcher)之执行action
- 安装mysql 5.7+版本缺少data文件夹
- C#连接Sql Serve数据库及增,删,改操作
- 在yii中使用分页
- 关于Vim的问题s
- Zookeeper 5、Zookeeper应用场景
- 用Maven打包成EAR远程部署JBoss(二)——部署到远程JBoss
- Eclipse最有用的快捷键
- IT连创业系列:App产品上线后,运营怎么搞?(中)
- RHCE6.4 rpm 安装gcc
- 用JNDI连接数据库
- Twisted 使用多线程
- QM
- LeetCode算法题-Number of Lines To Write String(Java实现)
- SpringBoot入门教程(二十一)IntelliJ IDEA配置Quartz启动项
- Java菜鸟浅谈OCR
- MySQL程序端启动密码错误解决方法
- python 进阶(转自http://python.jobbole.com/82633/)
- android studio InnerClass annotations are missing corresponding EnclosingMember annotations. Such InnerClass annota
- Sqlite向MySql导入数据