Change the javascript hidden value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rag84dec
    New Member
    • Mar 2007
    • 100

    Change the javascript hidden value

    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
    Code:
    var temp="name"+1;
    
    document.[B]temp[/B].value="newname";
    
    i want temp to be replaced by name1 so that the value of name1 field shud change.like this "[B]document.name1.value="newvalue" [/B] "



    Code:
    <input type='hidden' name='name1' value'Val'>
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    [code=javascript]document.forms[formName].elements[temp].value="newValu e";[/code]where formName is the name of the form.

    Comment

    • kunal pawar
      Contributor
      • Oct 2007
      • 297

      #3
      <input type='hidden' name='name1' id='name1' value'Val'>

      in javascript

      document.getEle mentById(''name 1'').value = "xvbcbcbvb" ;

      try this

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Yes, that's an alternative.

        Comment

        Working...