如何用java让两张图片循环显示

 时间:2024-10-05 21:16:05

如何用java让两张图片循环显示?

如何用java让两张图片循环显示

工具/原料

电脑

Eclipse

layui开发框架依赖包

方法/步骤

1、第一步、打开eclipse软件,如图所示:

如何用java让两张图片循环显示

2、第二步、点击菜单栏File--New---DynamicWebProject,如图所示:

如何用java让两张图片循环显示

3、第三步、输入项目名,然后点击Next按钮,如图所示:

如何用java让两张图片循环显示

4、第四步、继续点击Next按钮,如图所示:

如何用java让两张图片循环显示

5、第五步、勾选Generateweb.xmldeploymentdescriptor,勾袖稣拗然后点击Finish按钮,如图所示:

如何用java让两张图片循环显示

6、第六步、选中项目的WebContent文件夹鼠标右键New--->JSPFile文竭惮蚕斗件,如图所示:

如何用java让两张图片循环显示

7、输入JSP文件名,点击Next按钮,如图所示:

如何用java让两张图片循环显示

8、第八步、继续选中html5,然后点击Finish按钮,如图所示:

如何用java让两张图片循环显示

9、第九步、引入layui前端框架开发依赖包,然后再jsp文件中键入完整代码:<%@p瞢铍库祢agel锾攒揉敫anguage="java"contentType="text/html;charset=utf-8"pageEncoding="utf-8"%><!DOCTYPEhtml><html><head><metacharset="utf-8"><title>如何用java让两张图片循环显示</title><metaname="renderer"content="webkit"><metahttp-equiv="X-UA-Compatible"content="IE=edge,chrome=1"><metaname="viewport"content="width=device-width,initial-scale=1,maximum-scale=1"><linkrel="stylesheet"href="css/layui.css"media="all"><!--注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的--></head><body><fieldsetclass="layui-elem-fieldlayui-field-title"style="margin-top:50px;"><legend>填充轮播元素-以图片为例</legend></fieldset><divclass="layui-carousel"id="test10"><divcarousel-item=""><div><imgsrc="img/1.webp"></div><div><imgsrc="img/2.webp"></div></div></div><scriptsrc="js/layui.all.js"charset="utf-8"></script><!--注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的--><script>layui.use(['carousel','form'],function(){varcarousel=layui.carousel,form=layui.form;//常规轮播carousel.render({elem:'#test1',arrow:'always'});//改变下时间间隔、动画类型、高度carousel.render({elem:'#test2',interval:1800,anim:'fade',height:'120px'});//设定各种参数varins3=carousel.render({elem:'#test3'});//图片轮播carousel.render({elem:'#test10',width:'778px',height:'440px',interval:5000});//事件carousel.on('change(test4)',function(res){console.log(res)});var$=layui.$,active={set:function(othis){varTHIS='layui-bg-normal',key=othis.data('key'),options={};othis.css('background-color','#5FB878').siblings().removeAttr('style');options[key]=othis.data('value');ins3.reload(options);}};//监听开关form.on('switch(autoplay)',function(){ins3.reload({autoplay:this.checked});});$('.demoSet').on('keyup',function(){varvalue=this.value,options={};if(!/^\d+$/.test(value))return;options[this.name]=value;ins3.reload(options);});//其它示例$('.demoTest.layui-btn').on('click',function(){varothis=$(this),type=othis.data('type');active[type]?active[type].call(this,othis):'';});});</script></body></html>

如何用java让两张图片循环显示

10、第十步、把项目部署到Tomcat并启动,如图所示:

如何用java让两张图片循环显示

11、第十一步、在浏览器中输入地址访问项目:http://localhost:8080/Demo廴类锾渭02/index.jsp可以看到两张图片循环显示的效果,如图所示:

如何用java让两张图片循环显示

如何用java让两张图片循环显示

eclipse中shell窗口怎么居中显示 直接在myeclipse里写代码新建数据库 使用eclipse对话框 eclipse建立java窗口上的菜单栏 如何用Eclipse导出war包
热门搜索
礼仪图片大全 红警图片 鞋架图片 潘金莲电影 百合电影