Script Categories













Forms >>> Text Cycler.

Use the Up and Down arrows while in the text box to cycle through your choices.


Use the up and down arrow keys.

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var listOpt = new Array("", "Check", "out", "cool", "javascripts", "at", "yaldex.com");
var Ex = false;
var Net = false;
//var app = navigator.appName.substring(0,1);
if (!document.all) 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 == 40 && source == "target_box") cycleUp(source);
if(ev.which == 38 && source == "target_box") cycleDown(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>
<form name="cycleForm">
<input
name="target_box" value="" size="25"><br>
</form>
<b>Use the up and down arrow keys.</b>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©