set value for different hidden field in javascript function

admin

Administrator
Staff member
I need to set value to specific hidden field everytime when calling a javascript function cal(index)
e.g.
<script language="javascript">
function cal(index){
:
:
var thisForm = document.MC;
thisForm.score1.value=score[index];//set value to the hidden field
}
</script>
:
:
:
<input type="hidden" name="score1" value=http://www.webdeveloper.com/forum/archive/index.php/"">
<input type="hidden" name="score2" value="">
<input type="hidden" name="score3" value="">
:
:

i.e.
assign score[1] to thisForm.score1.value
assign score[2] to thisForm.score2.value
assign score[3] to thisForm.score3.value

how can i do this??
:confused:

i have tried to write like this
eval("thisForm.score"+index+".value")=score[index];
but i think i cannot assign a value to an execute function.

Pls help. Thanks in advance.
 
Back
Top