图片左右切换
来源:互联网 发布:淘宝自动登录怎么取消 编辑:程序博客网 时间:2024/05/22 00:37
<pre name="code" class="html"><!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>html属性操作</title>
<style>
*{ margin:0; padding:0}
#content{ width:400px; height:400px; border:10px solid #ccc; margin:40px auto; position:relative; background:#f1f1f1}
#content a{ width:40px; height:40px; background:#000; border:5px solid #fff; position:absolute; top:175px; text-align:center; line-height:40px; color:#fff; opacity:1; text-decoration:none}
#content a:hover{opacity:0.8}
#prev{ left:10px;}
#next{right:10px}
#text,#span1{ position:absolute; left:0; width:400px; border:0; height:30px; line-height:30px; background:#000; text-align:center; color:#fff;opacity:0.8}
#text{bottom:0;}
#span1{top:0;}
#img1{width:400px; height:400px;}
</style>
<script>
window.onload = function(){
var oText = document.getElementById('text');
var oPrev = document.getElementById('prev');
var oNext = document.getElementById('next');
var oSpan = document.getElementById('span1');
var oImg = document.getElementById('img1');
var arrUrl = ['img/1.jpg','img/2.jpg','img/3.jpg','img/4.jpg'];
var arrText = ['标题1','标题2','标题3','标题4'];
var num = 0;
//初始化
function fnTab(){
oSpan.innerHTML = num+1+'/'+arrText.length;
oImg.src=arrUrl[num];
oText.innerHTML=arrText[num];
}
fnTab();
oNext.onclick = function(){
num++;
if(num==arrText.length){
num=0;
}
fnTab();
}
oPrev.onclick = function(){
num--;
if(num==-1){
num=arrText.length-1;
}
fnTab();
}
}
</script>
</head>
<body>
<div id="content">
<a id="prev" href="javascript:;"><</a>
<a id="next" href="javascript:;">></a>
<p id="text">文字正在加载中</p>
<span id="span1">数量正在计算中</span>
<img id="img1"/>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>html属性操作</title>
<style>
*{ margin:0; padding:0}
#content{ width:400px; height:400px; border:10px solid #ccc; margin:40px auto; position:relative; background:#f1f1f1}
#content a{ width:40px; height:40px; background:#000; border:5px solid #fff; position:absolute; top:175px; text-align:center; line-height:40px; color:#fff; opacity:1; text-decoration:none}
#content a:hover{opacity:0.8}
#prev{ left:10px;}
#next{right:10px}
#text,#span1{ position:absolute; left:0; width:400px; border:0; height:30px; line-height:30px; background:#000; text-align:center; color:#fff;opacity:0.8}
#text{bottom:0;}
#span1{top:0;}
#img1{width:400px; height:400px;}
</style>
<script>
window.onload = function(){
var oText = document.getElementById('text');
var oPrev = document.getElementById('prev');
var oNext = document.getElementById('next');
var oSpan = document.getElementById('span1');
var oImg = document.getElementById('img1');
var arrUrl = ['img/1.jpg','img/2.jpg','img/3.jpg','img/4.jpg'];
var arrText = ['标题1','标题2','标题3','标题4'];
var num = 0;
//初始化
function fnTab(){
oSpan.innerHTML = num+1+'/'+arrText.length;
oImg.src=arrUrl[num];
oText.innerHTML=arrText[num];
}
fnTab();
oNext.onclick = function(){
num++;
if(num==arrText.length){
num=0;
}
fnTab();
}
oPrev.onclick = function(){
num--;
if(num==-1){
num=arrText.length-1;
}
fnTab();
}
}
</script>
</head>
<body>
<div id="content">
<a id="prev" href="javascript:;"><</a>
<a id="next" href="javascript:;">></a>
<p id="text">文字正在加载中</p>
<span id="span1">数量正在计算中</span>
<img id="img1"/>
</div>
</body>
</html>
0 0
- 左右图片切换
- 图片左右切换
- 左右滑动切换图片
- 图片的左右切换
- js左右箭头图片切换
- 图片展示(手动左右切换)
- 图片点击放大左右切换
- Android ImageSwitcher左右切换图片
- 带左右箭头图片切换
- vue 图片放大左右切换
- ViewFilpper、Gesture 实现图片左右滑动切换
- 仿京东图片左右切换效果jquery
- 图片左右循环切换功能的实现
- 基于ImageSwitcher实现的左右切换图片
- listview的HeadView左右切换图片
- javascript图片自动左右滑动滚动切换
- android 图片重影叠加左右切换效果
- javascript实现的简单图片左右切换
- C++作业2:距离
- 设计模式之创造者模式 Builder
- 什么是递归?
- Linux的环境变量
- JavaScript中"==, !="和"===, !=="的异同和优劣
- 图片左右切换
- 欢迎使用CSDN-markdown编辑器
- 士兵杀敌(二)
- 02-maven之helloWorld
- 一起talk C栗子吧(第一百三十四回:C语言实例--创建线程时的内存细节)
- 利用栈计算表达式的值
- 面向对象在javascript中的实践之多种方式创建对象
- C++第二次作业
- 排列问题