glotsa
03-03-2003, 04:01 AM
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="">
<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.
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="">
<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.