JS-javascript和css的互换
1.JavaScript中常用的事件列表
1. onclick(当用户单击某个对象时调用事件)
2. onmouseover(鼠标移到某元素之上)
3. onmouseout(鼠标从某元素移开)
4. onmousedown(鼠标按钮被按下)
2.跟换菜单背景案例
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>更换菜单背景颜色</title>
<style>
div{
float:left;width:103px;height:33px;background-image:url(img/bg1.gif);color:#FFF;
text-align:center;line-height:33px;margin-left:3px;font-size:15px;
}
.la{
background-image:url(img/bg2.gif)
};
.lb{
background-image:url(img/bg1.gif)
};
</style>
</head>
<script type="text/javascript">
</script>
<body>
<div onmousemove="this.className ='la'" onmouseout="this.className = 'lb'">
咨询动态
</div>
<div onmousemove="this.className ='la'" onmouseout="this.className = 'lb'">
产品世界
</div>
<div onmousemove="this.className ='la'" onmouseout="this.className = 'lb'">
市场营销
</div>
</body>
</html>
2.1案例效果图
3.广告随鼠标滚动案例
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div style="position: fixed;">
<img src="img/adv.gif"/>
</div>
<div>
<img src="img/1.1.png"/>
<img src="img/1.2.png"/>
<img src="img/1.3.png"/>
<img src="img/1.4.png"/>
<img src="img/1.5.png"/>
</div>
</body>
</html>