it's quite possible that you are referencing your form incorrectly. If you are just working with named fields (ie, no id's), easiest is to name your form.
you will also want to remove the dot between the form reference and the first square bracket, and also bear in mind that you are starting your loop off at 0 but your field names start at 1:
Code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form name="myform">
<input type="text" name="dirLen1"/>
<input type="text" name="dirLen2"/>
<input type="text" name="dirLen3"/>
</form>
<script type = "text/javascript">
var dirLen=[5,7,9]
for(var k=0;k<dirLen.length;k++){
document.myform["dirLen"+(k+1)].value=dirLen[k]
}
</script>
</body>
</html>
Bookmarks