本文实例为大家介绍了javascript图片切换的两种方式,循环切换以及顺序切换的实例代码,分享给大家供大家参考,具体内容如下
p{margin:0;} input{border:none;outline: none;margin:0;padding:0;} img{width:300px;height:300px;} #loop{margin-left:50px;background:#c80;width:60px;height:40px;font-size:14px;line-height:20px;text-align: center;} #order{margin-left:50px;background:#c80;width:60px;height:40px;font-size:14px;line-height:20px;text-align:center;} div{width:300px;height:300px;position:relative;} span{position:absolute;left:0;top:0;width:300px;height:20px;font-size:14px;line-height:20px;background:#000;opacity:0.5;color:#fff;text-align: center;} div p{position:absolute;left:0;bottom:0;width:300px;height:20px;font-size:14px;line-height:20px;text-align: center;color:#fff;background:#000;opacity:0.5;} div input{position:absolute;width:60px;height:60px;top:100px;background:pink;} #back{left:0;} #next{right:0;} 图片可以从第一张到最后一张循环切换
1/4图片1
图片切换即两张图片轮流切换代码:
#text{width:200px;height:200px;font-size:40px;line-height:40px;text-align: center;} img{width:200px;height:200px;} 图片1
以上就是本文的全部内容,希望对大家的学习javascript程序设计有所帮助。



