posted 21 years ago
Hi,
If I have a form element, for example,
<select name="selTest" id="selTest">
<option> ...//code to add options
</select>
or
<input type = "text" name="txtTest" value="xxx">
In a javascript function, if I refer to these form elements using their names directly, it is OK. However, if I use a variable, for example,
function changeValue(frm, para1){
frm.para1.value= ....;
}
or
function changeValue(frm, para1){
var ele=para1;
frm.ele.value=....;
}
Then call changeValue(form, "txtTest"), I got an error that para1 or ele is null or not object.
Can someone tell me what is wrong and how to fix it?