jsp图片效果大全(图像震动效果、闪烁效果、自动切换图像)
本文主要介绍jsp实现图像震动效果、闪烁效果、自动切换图像的资料,废话不多说了,具体代码如下:
1.当鼠标指针经过图像时图像震动效果
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <head> <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/> <title>当鼠标指针经过图像时图像震动效果</title> <styletype="text/css"> .zhendimage{position:relative;} </style> <scripttype="application/javascript"> varrector=3; varstopit=0; vara=1; varzhend; functioninit(which) { stopit=0; zhend=which; zhend.style.left=0; zhend.style.top=0; } functionrattleimage() { if(stopit==1) { return; } if(a==1) { zhend.style.top=parseInt(zhend.style.top)+rector+"px"; } elseif(a==2) { zhend.style.left=parseInt(zhend.style.left)+rector+"px"; } elseif(a==3) { zhend.style.top=parseInt(zhend.style.top)-rector+"px"; } else { zhend.style.left=parseInt(zhend.style.left)-rector+"px"; } if(a<4)a++;elsea=1; setTimeout("rattleimage()",50); } functionstoprattle(which) { stopit=1; which.style.left=0; which.style.top=0; } </script> </head> <body> <div> <imgclass="zhendimage"onmousemove="init(this);rattleimage();" onmouseout="stoprattle(this);"src="http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg002.png"/></div> </body> </html>
2.图片闪烁效果
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <head> <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/> <title>图片闪烁效果</title> <scripttype="application/javascript"> functionblink() { //定义图片的显示和隐藏属性 tp.style.visibility=(tp.style.visibility=="hidden")?"visible":"hidden"; //每0.5秒刷新一次 setTimeout("blink()",500); } </script> </head> <bodyonload="blink();"> <divid="tp"> <imgsrc="http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg003.jpg"style="width:160px;height:160px;"/> </div> </body> </html>
3.自动切换图像
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml"> <head> <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/> <title>自动切换图像</title> <scripttype="application/javascript"> varimgs=newArray ( "http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg003.jpg", "http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg004.gif", "http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_%e6%9a%82%e6%97%a0%e5%9b%be%e7%89%87.gif" ) varnums=0; setInterval("fort()",1000); functionfort() { iimg.src=imgs[nums]; nums++; if(nums==3)nums=0; } </script> </head> <body> <div><imgid="iimg"src="http://images.cnblogs.com/cnblogs_com/yc-755909659/559257/o_ycimg003.jpg"height="160"width="160"/></div> </body> </html>
希望本文所述对你有所帮助,jsp图片效果大全(图像震动效果、闪烁效果、自动切换图像)内容就给大家介绍到这里了。希望大家继续关注我们的网站!想要学习介绍jsp可以继续关注本站。