bikebanditcom
Programmer
I have the following javascript, that as you can see dynamically generates two fields, i'll be adding two more fields that will be dependendent on the first two fields, i haven't worked out the dependendent drop downs, but i need to know how i can loop thru this code in vbscript on my take_sale.asp page, can anyone help? Thank you
<script language="JavaScript">
<!-- Dynamic Form
var recordCount = 0;
//start AddRow function block
function AddRow(){
var elemTbody, elemRow;
var elemCols = new Array(2);
var elemPackType, elemPackLevel
//create a reference to the tbody element in our table
elemTbody = document.getElementById("ResultTable"
.getElementsByTagName("tbody"
[0];
//create the tr and td objects
elemRow = document.createElement("tr"
;
elemCols[0] = document.createElement("td"
;
elemCols[1] = document.createElement("td"
;
//create our text inputs and our select dropdown
elemPackType = document.createElement("select"
;
elemPackLevel = document.createElement("select"
;
var elemOption;
var elemOption2;
//do the select box next
elemPackType.name = "packType_" + recordCount;
elemPackType.size = "1";
elemPackLevel.name = "packLevel_" + recordCount;
elemPackLevel.size = "1";
//add the options
var optCtr;
// creating a new option: text, value
//add the option
elemOption = new Option("Select One","Select One"
;
elemPackType.add(elemOption);
elemOption = new Option("Type1","Type1"
;
elemPackType.add(elemOption);
elemOption2 = new Option("Select One","Select One"
;
elemPackLevel.add(elemOption2);
elemOption2 = new Option("Level1","Level1"
;
elemPackLevel.add(elemOption2);
//add the inputs to the appropriate cells
elemCols[0].appendChild(elemPackType);
elemCols[1].appendChild(elemPackLevel);
//add the cols to the row
elemRow.appendChild(elemCols[0]);
elemRow.appendChild(elemCols[1]);
//add the row to the tbody tag
elemTbody.appendChild(elemRow);
//increment recordCount and update hdnRecordCount input
recordCount++;
document.getElementById("recCount"
.value = recordCount;
}
// end of AddRow function block
//End Dynamic Form
//-->
</script>
<script language="JavaScript">
<!-- Dynamic Form
var recordCount = 0;
//start AddRow function block
function AddRow(){
var elemTbody, elemRow;
var elemCols = new Array(2);
var elemPackType, elemPackLevel
//create a reference to the tbody element in our table
elemTbody = document.getElementById("ResultTable"
//create the tr and td objects
elemRow = document.createElement("tr"
elemCols[0] = document.createElement("td"
elemCols[1] = document.createElement("td"
//create our text inputs and our select dropdown
elemPackType = document.createElement("select"
elemPackLevel = document.createElement("select"
var elemOption;
var elemOption2;
//do the select box next
elemPackType.name = "packType_" + recordCount;
elemPackType.size = "1";
elemPackLevel.name = "packLevel_" + recordCount;
elemPackLevel.size = "1";
//add the options
var optCtr;
// creating a new option: text, value
//add the option
elemOption = new Option("Select One","Select One"
elemPackType.add(elemOption);
elemOption = new Option("Type1","Type1"
elemPackType.add(elemOption);
elemOption2 = new Option("Select One","Select One"
elemPackLevel.add(elemOption2);
elemOption2 = new Option("Level1","Level1"
elemPackLevel.add(elemOption2);
//add the inputs to the appropriate cells
elemCols[0].appendChild(elemPackType);
elemCols[1].appendChild(elemPackLevel);
//add the cols to the row
elemRow.appendChild(elemCols[0]);
elemRow.appendChild(elemCols[1]);
//add the row to the tbody tag
elemTbody.appendChild(elemRow);
//increment recordCount and update hdnRecordCount input
recordCount++;
document.getElementById("recCount"
}
// end of AddRow function block
//End Dynamic Form
//-->
</script>