这篇文章主要介绍了 js 动态切换图片的方法, 包含完整的 CSS 文件与 js 文件实现技巧, 非常具有实用价值, 需要的朋友可以参考下
Javascript 是一种由 Netscape 的 LiveScript 发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如 Perl,遗留的速度问题,为客户提供更流畅的浏览效果。
本文实例讲述了 js 动态切换图片的方法。分享给大家供大家参考。具体实现方法如下:
index.css 文件如下:
- * {
- margin: 0px;padding: 0px;
- }
- body {
- width: 632px;
- /*background-color: blue;*/
- margin: 0 auto;
- }
- #imgsCom {
- background-color: yellow;
- /*相对定位,为了下层可以使用绝对定位时以本div的原点为原点*/
- position: relative;
- }
- #ulnav{
- list-style-type: none;
- position: absolute;
- /*使用以imgsCom为原点来绝对定位到右下角*/
- bottom: 0px;
- right: 0px;
- }
- #ulnav li{
- list-style-type: none;
- float: left;
- background-color: black;
- color: white;
- margin-right: 5px;
- width: 20px;
- height: 20px;
- line-height: 20px;
- text-align: center;
- cursor: pointer;
- }
index.html 如下:
希望本文所述对大家的 javascript 程序设计有所帮助。
来源: