An array would probably be easiest as then you'd only need a single statement to do the assignment.
Code:
<script type="text/javascript">
var vals = ["Off","Auto","Manual"];
function modetext()
{
i = document.getElementById('datamem14').value;
if (i < 0 || i >= vals.length) i = 0;
document.getElementById('mode').value = vals[i];
}
</script>
Just add as many entries to the array as you need, the rest of the code will not need to be changed.