1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "Utf-8"/>5 6 <title>7 8 </title>9 Ten </Head> One <style> A #zp img{ - margin:0 Auto; - } the </style> - <Body> - <DivID= "ZP"> - <imgsrc= "Iamges/46.png"width= "+"Height= "$"ID= "IMG1"/> + </Div> - + <inputtype= "button"value= "Previous"onclick= "sz ()"/> A at <inputtype= "button"value= "Next"onclick= "XZ ()"/> - </Body> - - <Scripttype= "Text/javascript"> - varPicarr=NewArray ("Iamges/46.png","Iamges/47.png","Iamges/48.png","Iamges/49.png","Iamges/50.png"); - in varXP=0; - to functionsz () { + - XP++; the if(XP==picarr.length) { * XP=0; $ }Panax Notoginseng document.getElementById ("IMG1"). SRC=PICARR[XP]; - } the + functionxz () { A XP--; the if(XP<0){ + XP=Picarr.length-1; - } $ document.getElementById ("IMG1"). SRC=PICARR[XP]; $ } - </Script> - </HTML>View Code
JS Simple picture switch