Mortgages - Loans - Chomsky - Loans - Credit Card Consolidation

PDA

View Full Version : Changing the hidden value in a javascript function


rag84dec
Feb 6th 2008, 8:57 pm
Hi,
i want to change the hidden elemtn value in the javascript.
the name of the filed will have to be formed in the javascript.

like this

var temp="name"+1;

document.temp.value="newname";

i want temp to be replaced by name1 so that the value of name1
field shud change.like
this "document.name1.value="newvalue" "







<input type='hidden' name='name1' value'Val'>

fairuz.ismail
Feb 6th 2008, 10:57 pm
<input type="hidden" name="name1" value="Val" id="myID"/>

var temp="name"+1;
document.getElementById('myID').setAttribute('name',temp);
document.getElementById('myID').value = "newvalue";

i dont test this..

rag84dec
Feb 6th 2008, 11:57 pm
thanks a lot...it worked...:)