planeboy747
Technical User
Is it possible for an onChange to call 2 functions at the same time?
Here's my onChange:
--------------------
<select name="select" onchange="adjustRows(this.value,nameSet)">
Here's my code for this script:
--------------------------------
function insertRows(isTable){
index = isTable.rows.length;
nextRow = isTable.insertRow(index);
isText1 = nextRow.insertCell(0);
isText2 = nextRow.insertCell(1);
index++;
index = index.toString();
nameStr1 = "Lname"+index;
nameStr2 = "Fname"+index;
txtStr1 = "Last Name "+index+":<br><input name="+nameStr1+" type='text' size='18' maxlength='18'>";
txtStr2 = "First Name "+index+":<br><input name="+nameStr2+" type='text' size='18' maxlength='22'>";
isText1.innerHTML = txtStr1;
isText2.innerHTML = txtStr2;
isText1.width ='25%'
isText2.width = '75%'
}
function adjustRows(isVal,isTable){
currRows = isTable.rows.length;
newRows = isVal;
if (currRows > 0){for (i=0; i<currRows-0; i++){isTable.deleteRow()}}
for (i=0; i<newRows; i++){insertRows(isTable)}
}
I'd like the function below with the same onChange above if possible, just not sure how you add this function to call on the onChange value?
--------------------------------
function insertRowsTN(isTable){
index = isTable.rows.length;
nextRow = isTable.insertRow(index);
isText1 = nextRow.insertCell(0);
index++;
index = index.toString();
nameStr1 = "TN1"+index;
txtStr1 = "Passenger 1 "+index+":<br><input name="+nameStr1+" type='text' size='18' maxlength='18'>";
isText1.innerHTML = txtStr1;
isText1.width ='25%'
}
function adjustRowsTN(isVal,isTable){
currRows = isTable.rows.length;
newRows = isVal;
if (currRows > 0){for (i=0; i<currRows-0; i++){isTable.deleteRow()}}
for (i=0; i<newRows; i++){insertRows(isTable)}
}
thanks
j
Here's my onChange:
--------------------
<select name="select" onchange="adjustRows(this.value,nameSet)">
Here's my code for this script:
--------------------------------
function insertRows(isTable){
index = isTable.rows.length;
nextRow = isTable.insertRow(index);
isText1 = nextRow.insertCell(0);
isText2 = nextRow.insertCell(1);
index++;
index = index.toString();
nameStr1 = "Lname"+index;
nameStr2 = "Fname"+index;
txtStr1 = "Last Name "+index+":<br><input name="+nameStr1+" type='text' size='18' maxlength='18'>";
txtStr2 = "First Name "+index+":<br><input name="+nameStr2+" type='text' size='18' maxlength='22'>";
isText1.innerHTML = txtStr1;
isText2.innerHTML = txtStr2;
isText1.width ='25%'
isText2.width = '75%'
}
function adjustRows(isVal,isTable){
currRows = isTable.rows.length;
newRows = isVal;
if (currRows > 0){for (i=0; i<currRows-0; i++){isTable.deleteRow()}}
for (i=0; i<newRows; i++){insertRows(isTable)}
}
I'd like the function below with the same onChange above if possible, just not sure how you add this function to call on the onChange value?
--------------------------------
function insertRowsTN(isTable){
index = isTable.rows.length;
nextRow = isTable.insertRow(index);
isText1 = nextRow.insertCell(0);
index++;
index = index.toString();
nameStr1 = "TN1"+index;
txtStr1 = "Passenger 1 "+index+":<br><input name="+nameStr1+" type='text' size='18' maxlength='18'>";
isText1.innerHTML = txtStr1;
isText1.width ='25%'
}
function adjustRowsTN(isVal,isTable){
currRows = isTable.rows.length;
newRows = isVal;
if (currRows > 0){for (i=0; i<currRows-0; i++){isTable.deleteRow()}}
for (i=0; i<newRows; i++){insertRows(isTable)}
}
thanks
j