<script
language="javascript"
type="text/javascript">
var
listOpt =
new
Array("",
"Check",
"out",
"cool",
"javascripts",
"at",
"yaldex.com");
var
Ex =
false;
var
Net =
false;
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];
}
</script>
<form
name="cycleForm">
<input
name="target_box"
value=""
size="25"><br>
</form>
<b>Use
the up and down arrow keys.</b>