Copy codeThe Code is as follows:
Function SetFormValue (column, values)
{
Var elem;
For (var m = 0; m <column. length; m ++)
{
Var tempValue = column [m];
Elem = null;
Elem = document. getElementById (tempValue );
If (elem = null)
{
// Skip this loop if no corresponding control exists
Continue;
}
Var trueValue = eval ("values. Rows [0]." + tempValue );
If (trueValue = ''| trueValue = 'null' | trueValue = null)
{
// Skip this loop if the current value is null
Continue;
}
If (elem. tagName = 'select ')
{
// Additional processing of the select Control
For (var j = 0; j <elem. length; j ++)
{
If (trueValue = elem. options [j]. value)
{
// Find the corresponding element and select it
Elem. options [j]. selected = true;
// And make it optional
Elem. disabled = true;
// Exit the loop
Break;
}
}
}
Else if (elem. tagName = 'input ')
{
Elem. value = trueValue;
Elem. readOnly = true;
}
}
}