zoukankan      html  css  js  c++  java
  • 图片切换实例

    <html>
    <head>
    	<meta http-equiv="content-type" content="text/html" charset="UTF-8">
    	<script type="text/javascript" >
    			var picArr=new Array("1.jpg","2.jpg","3.jpg")	;
    			var index=0;
    			//展示下一张图片
    			function next(){
    					index++;
    					if (index==picArr.length){
    							index=0;
    					}
    					document.getElementById("img1").src=picArr[index];
    			}
    
    			//展示上一张图片
    			function precious(){
    					index--;
    					if (index<0){
    							index=picArr.length-1;
    					}
    					document.getElementById("img1").src=picArr[index];
    			
    			}
    	</script>
    	<body>
    			<img id="img1"src="1.jpg" width="500" height="300"/><br/>
    			<input type="button" value="下一张" onclick="next()"/>
    			<input type="button" value="上一张" onclick="precious()"/>
    	<body>
    	</html>
    
  • 相关阅读:
    web自动化中的上传操作
    HTTP协议
    创建一个get测试
    下载安装
    unittest 介绍
    selenium常用操作
    video视频操作
    调用JavaScript
    下拉框操作
    弹窗操作
  • 原文地址:https://www.cnblogs.com/sosomark/p/5188500.html
Copyright © 2011-2022 走看看