I have a form text field called "field_0", and javascript code:
<script language="javascript">
function test() {
var a=document.form1.field_0.value;
alert (a);
}
</script>
<form name=form1 ....>
<input type=text name=field_0>
<input type=text name=field_1>
<....onclick='javascript: test();'>
</form>
if I run this, it pops up correct message box with the "field_0" value.
However if I change a little in javascript code:
<script language="javascript">
function test() {
var fd="field_0";
var a=document.form1.fd.value;
alert (a);
}
</script>
this script will no longer work, how can I use variable "fd" in "document.form...."? any idea?
Thanks.