HTML——JAVASCRIPT练习题——图片轮播
方法一:
<!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>无标题文档</title>
<title>无标题文档</title>
<style type="text/css">
#tu
{
width:400px;
float:left; }
#a,#b,#c,#d,#e,#f,#g
{
width:500px;
height:350px;
float:left;
float:left;
}
</style> </head>
<body>
<div id="tu">
<img id="a" src="207.jpg" style="display:block"/>
<img id="b" src="t01ba56e06b53e9d8ba.jpg" style="display:none"/>
<img id="c" src="1.gif" style="display:none"/>
<img id="d" src="3-1.jpg" style="display:none"/>
<img id="e" src="TFMW20150411_Yale_0022_NEW_Rotator.jpg" style="display:none"/>
<img id="f" src="t01ba56e06b53e9d8ba.jpg" style="display:none"/>
<img id="g" src="TFMW20150411_Yale_0022_NEW_Rotator.jpg" style="display:none"/>
</div>
</body>
<script type="text/javascript">
var jihe=new Array();
jihe[]=document.getElementById("a");
jihe[]=document.getElementById("b");
jihe[]=document.getElementById("c");
jihe[]=document.getElementById("d");
jihe[]=document.getElementById("e");
jihe[]=document.getElementById("f");
jihe[]=document.getElementById("g"); var n=;
function change()
{
n++;
if(n==)
{
jihe[].style.display="block";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none"; }
else if(n==)
{
jihe[].style.display="none";
jihe[].style.display="block";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
}
else if(n==)
{
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="block";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
}
else if(n==)
{
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="block";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
}
else if(n==)
{
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="block";
jihe[].style.display="none";
jihe[].style.display="none";
}
else if(n==)
{
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="block";
jihe[].style.display="none";
}
else if(n==)
{
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="none";
jihe[].style.display="block";
}
else
{
n=;
}
window.setTimeout("change()",); }
window.setTimeout("change()",);
</script>
</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>无标题文档</title>
<style type="text/css">
#tu
{
width:400px;
float:left; }
#a,#b,#c,#d,#e,#f,#g
{
width:500px;
height:350px;
float:left;
float:left;
}
</style>
</head>
<body>
<div id="tu">
<img id="a" src="042815_Nano_468_605.jpg" style="display:block"/>
<img id="b" src="RadArt1_922.jpg" style="display:none"/>
<img id="c" src="zebrafish-522_0.jpg" style="display:none"/>
<img id="d" src="Wheat-original_605.jpg" style="display:none"/>
<img id="e" src="TFMW20150411_Yale_0022_NEW_Rotator.jpg" style="display:none"/>
<img id="f" src="t01ba56e06b53e9d8ba.jpg" style="display:none"/>
<img id="g" src="TFMW20150411_Yale_0022_NEW_Rotator.jpg" style="display:none"/>
</div>
</body>
<script type="text/javascript">
var jihe=new Array();
jihe[]=document.getElementById("a");
jihe[]=document.getElementById("b");
jihe[]=document.getElementById("c");
jihe[]=document.getElementById("d");
jihe[]=document.getElementById("e");
jihe[]=document.getElementById("f");
jihe[]=document.getElementById("g"); var n=;
function change()
{
n++;
if(n==)
{
n=;
} hideall(jihe);
jihe[n].style.display="block"; window.setTimeout("change()",); }
function hideall(a)
{
for(var i=;i<;i++)
{
a[i].style.display="none";
}
}
window.setTimeout("change()",);
</script> </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>无标题文档</title>
</head> <body>
<div id="d" style="background-image:url(3-1.jpg); height:200px; width:200px;"></div>
</body>
<script type="text/javascript">
var img=new Array();
img[]="url(042815_Nano_468_605.jpg)";
img[]="url(RadArt1_922.jpg)";
img[]="url(zebrafish-522_0.jpg)";
img[]="url(TFMW20150411_Yale_0022_NEW_Rotator.jpg)";
img[]="url(t01ba56e06b53e9d8ba.jpg)"; var n=;
function change()
{
if(n==)
{
n=;
}
else
{
n++;
}
document.getElementById("d").style.backgroundImage=img[n];
window.setTimeout("change()",);
}
window.setTimeout("change()",); </script>
</html>
HTML——JAVASCRIPT练习题——图片轮播的更多相关文章
- javascript 实现图片轮播和点击切换功能
图片轮播是网页上一个比较常见的功能,下面我们来实现他吧 原理很简单: 1:固定的区域,所有的图片重叠,一次只能显示一张图片 2:通过改变图片的zIndex属性改变显示的图片,就可以达到切换的效果了 & ...
- JavaScript实现图片轮播组件
效果: 自动循环播放图片,下方有按钮可以切换到对应图片. 添加一个动画来实现图片切换. 鼠标停在图片上时,轮播停止,出现左右两个箭头,点击可以切换图片. 鼠标移开图片区域时,从当前位置继续轮播. 提供 ...
- 原生Javascript实现图片轮播效果
首先引入js运动框架 function getStyle(obj,name){ if(obj.currentStyle){ return obj.currentStyle[name]; } else{ ...
- Bootstrap3.0学习第二十六轮(JavaScript插件——图片轮播)
详情请查看http://aehyok.com/Blog/Detail/32.html 个人网站地址:aehyok.com QQ 技术群号:206058845,验证码为:aehyok 本文文章链接:ht ...
- JavaScript实现图片轮播图
<!DOCTYPE html><html> <head> <script > var time; function init(){ //设置定时操作 t ...
- 纯javaScript、jQuery实现个性化图片轮播
纯javaScript实现个性化图片轮播 轮播原理说明<如上图所示>: 1. 画布部分(可视区域)属性说明:overflow:hidden使得超出画布部分隐藏或说不可见.position: ...
- Javascript和jQuery WordPress 图片轮播插件, 内容滚动插件,前后切换幻灯片形式显示
用于在有限的网页空间内展示一组产品图片或者照片,同时还有非常吸引人的动画效果.本文向大家推荐12款实用的 jQuery 图片轮播效果插件,帮助你在你的项目中加入一些效果精美的图片轮播效果,希望这些插件 ...
- html+css+javascript实现简易轮播图片
html: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <lin ...
- JavaScript对象(document对象 图片轮播)
图片轮播: 需要注意的HTML需要img标签,他和input标签一样,是非封闭的标签 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran ...
随机推荐
- ES6的模块化
在之前的 javascript 中一直是没有模块系统的,前辈们为了解决这些问题,提出了各种规范, 最主要的有CommonJS和AMD两种.前者用于服务器,后者用于浏览器.而 ES6 中提供了简单的模块 ...
- PHP: configure: error: mysql configure failed. Please check config.log for more information.
为php增加mysql模块时报错 configure: error: mysql configure failed. Please check config.log for more informat ...
- [Python笔记][第一章Python基础]
2016/1/27学习内容 第一章 Python基础 Python内置函数 见Python内置函数.md del命令 显式删除操作,列表中也可以使用. 基本输入输出 input() 读入进来永远是字符 ...
- 【筛素数表证明】【O[n]】
void get_prime() { int cnt = 0; for (int i = 2; i < N; i++) { if (!tag[i]) p[cnt++] = i; for (int ...
- 通过匹配绑定select option的文本值 模糊匹配
//通过匹配绑定select option的文本值 模糊匹配 $(".class option:contains('文本值')").attr("selected" ...
- 用户"IIS APPPOOL\xxxxxxxx"登录失败解决方案
Server Error in '/' Application.-------------------------------------------------------------------- ...
- 【SQL语句】 - 在所有存储过程中查找关键字,关键字不区分大小写 [sp_findproc]
USE [EShop]GO/****** Object: StoredProcedure [dbo].[sp_findproc] Script Date: 2015/8/19 11:05:24 *** ...
- Objective-C——NSMutableURLRequest发送POST请求,使用NSJSONSerialization解析JSON字符串
NSString *reqData = @"Data="; NSData *postDatas = nil; NSString *urlPath = @"url" ...
- Sum Problem-hdu-1001
Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge). In this problem, your task is to calc ...
- static_cast与dynamic_cast转换 最简单的理解
3.1 static_cast用法:static_cast < type-id > ( exdivssion ) 该运算符把exdivssion转换为type-id类型,但没有运行时类型检 ...