»
EnglishFrenchVietnamese

Print - Text Cycler - JavaScriptBank.com

Full version: jsB@nk » Form » Textarea » Text Cycler
URL: https://www.javascriptbank.com/text-cycler.html

Text Cycler © JavaScriptBank.comUse the Up and Down arrows while in the textbox to cycle through your choices. InternetExplorer users can go up and down through the list, Netscape users can only go down through the list. Neat!

Full version: jsB@nk » Form » Textarea » Text Cycler
URL: https://www.javascriptbank.com/text-cycler.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// James Gough (wheresjim@hotmail.com)<!-- Beginvar listOpt = new Array("", "Check", "out", "cool", "javascripts", "at", "JSBank");var Ex = false;var Net = false;var app = navigator.appName.substring(0,1);if (app == 'N') Net = true; else Ex = true;document.onkeyup = keyUp;if (Net) document.captureEvents(Event.KEYUP);function keyUp(ev) {if (Net) { var source = ev.target.name;if(source) {if(ev.which == 0 && source == "target_box") cycleUp(source);   }}else if (Ex) {var source = window.event.srcElement.name;if(source) {if(window.event.keyCode == 40 && source  == "target_box") cycleUp(source);if(window.event.keyCode == 38 && source  == "target_box") cycleDown(source);      }   }}var arrayIndex = 0;function cycleUp(source) {arrayIndex++;if(arrayIndex > listOpt.length-1) arrayIndex = 0;var change_box = eval("document.cycleForm." + source);change_box.value = listOpt[arrayIndex];}function cycleDown(source) {arrayIndex--;if(arrayIndex < 0) arrayIndex = listOpt.length - 1;var change_box = eval("document.cycleForm." + source);change_box.value = listOpt[arrayIndex];}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="cycleForm"><input name="target_box" value="" size="25"><br></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->