html点击按钮时切换图片的代码

简单的切换图片,就是点方向箭头切换图片,不用自动切换,有个循环就行了
我是初学者,加太多我会看不懂。。。
应该是要用到jq吧?尽量简单些。。。
麻烦了。。。

html点击按钮时切换图片的代码如下:

<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>

<style>

#hello{width:108px;height:108px;border:1px solid #369;overflow:hidden;margin:auto;}

#word{margin:auto;width:136px;}

</style>

<div id="hello">

<img src="http://i1.baidu.com/it/u=2390401277,3891827753&fm=203">

<img src="http://i1.baidu.com/it/u=3713675608,2219355047&fm=203">

<img src="http://i2.baidu.com/it/u=695011303,1300693603&fm=203">

</div>

<div>

<input type="button" value="上一张" onclick="a()";>

<input type="button" value="下一张" onclick="b()";>

</div>

<script>

function a(){

$('#hello').find('img').eq(0).appendTo($('#hello'));

}

function b(){

$('#hello').find('img:last').eq(0).prependTo($('#hello'));

}

</script>

HTML超级文本标记语言文档制作不是很复杂,但功能强大,支持不同数据格式的 文件镶入,这也是万维网( WWW)盛行的原因之一,其主要特点如下:

    简易性:超级文本标记语言 版本升级采用 超集方式,从而更加灵活方便。

    可扩展性:超级文本标记语言的广泛应用带来了加强功能,增加 标识符等要求,超级文本标记语言采取子类元素的方式,为系统扩展带来保证。

    平台无关性:虽然 个人计算机大行其道,但使用 MAC等其他机器的大有人在,超级文本标记语言可以使用在广泛的平台上,这也是 万维网( WWW)盛行的另一个原因。

    通用性:另外, HTML是网络的通用语言,一种简单、通用的全置标记语言。它允许网页制作人建立文本与图片相结合的复杂页面,这些页面可以被网上任何其他人浏览到,无论使用的是什么类型的电脑或浏览器。

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2018-02-27
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<style>
#hello{width:108px;height:108px;border:1px solid #369;overflow:hidden;margin:auto;}
#word{margin:auto;width:136px;}
</style>

<div id="hello">
<img src="http://i1.baidu.com/it/u=2390401277,3891827753&fm=203">
<img src="http://i1.baidu.com/it/u=3713675608,2219355047&fm=203">
<img src="http://i2.baidu.com/it/u=695011303,1300693603&fm=203">
</div>

<div>
<input type="button" value="上一张" onclick="a()";>
<input type="button" value="下一张" onclick="b()";>
</div>

<script>
function a(){
    $('#hello').find('img').eq(0).appendTo($('#hello'));
}
function b(){
    $('#hello').find('img:last').eq(0).prependTo($('#hello'));
}

</script>

本回答被提问者和网友采纳