»
Tiếng AnhTiếng PhápTiếng Việt

In - Slideshow bằng bàn phím - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Hình ảnh » Slideshow bằng bàn phím
URL: https://www.javascriptbank.com/image-animation-by-keyboard.html

Slideshow bằng bàn phím © JavaScriptBank.comHiệu ứng tạo một sildeshow ảnh bằng bàn phím.

Phiên bản đầy đủ: jsB@nk » Hình ảnh » Slideshow bằng bàn phím
URL: https://www.javascriptbank.com/image-animation-by-keyboard.html



JavaScript
<script language="Javascript" type="text/javascript"><!-- Hide script from old browsersmyPix = new Array("pic191.jpg","logojs.gif","photo1.jpg","photo2.jpg","photo3.jpg","photo4.jpg","photo5.jpg","photo6.jpg","photo7.jpg")thisPic = 0imgCt = myPix.length - 1document.onkeydown = keyHitif (document.layers) {document.captureEvents(Event.KEYDOWN)ltArrow = 28rtArrow = 29}else {ltArrow = 37rtArrow = 39}function keyHit(evt) {if (evt) {thisKey = evt.which}else {thisKey = window.event.keyCode}if (thisKey == ltArrow) {chgSlide(-1)}else if (thisKey == rtArrow) {chgSlide(1)}}function chgSlide(direction) {if (document.images) {thisPic = thisPic + directionif (thisPic > imgCt) {thisPic = 0}if (thisPic < 0) {thisPic = imgCt}document.myPicture.src=myPix[thisPic]}}// End hiding script from old browsers --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<b>Use the right and left arrows on your keyboard to view the slideshow</b><br><img src="pic191.jpg" name="myPicture" alt="Slideshow"><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->