I'm trying to automate option lists with the following code:
 <script type=text/javascript>
 	function arraymaker() {
 		this.length = arraymaker.arguments.length
 		 for (var i = 0; i < this.length; i++)
 		 this[i+1] = arraymaker.arguments[i]
 	var valvar = new arraymaker ( "", "Bkt", "Fan", "Air", "Fld", "Hrd", 
 			"Int", "Pre", "Scr", "Tee", "Tir", "Tol", "Use" );
 	var descpt = new arraymaker ( "", "Buckets", "Fans - Cooling", 
 			"Filters - Air, Lube, Industrial", "Fluids", 
 			"Hardware",	"Intake/Exhast Systems", "Pre-Cleaning - Air", 
 			"Scrapers", "Teeth", "Tires", "Tools - Ground Engaging", 
 			"Used Parts" );
 	<SCRIPT type=text/javascript>
 		tot = descpt.length;
 		for (var i = 1; i <= tot; i++)
 			if == valvar[i] {
 				var outln = '<OPTION selected value=' + valvar[i] + '>' + descpt[i];
 			else {
 				var outln = '<OPTION value=' + valvar[i] + '>' + descpt[i];

But something seems to be wrong in the arraymaker function and I have not been able to figure it out.

The reason the automation is needed is the Selected line gets lost in screen refreshing, because it is not set by looking at the value prior to executing a screen refresh/repaint.

Also it make entering the values in the array lists easier or allows to build them (with additional code) from a database.

Just was wondering if anyone knew how to do this?