Saturday, 15 January 2011

javascript - getelementsbyname doesn't work with var[x] -


Let me hide some hidden feeds like:

  & lt; Input type = "hidden read" name = "check [0]" value = "5276de80e3b91e48cc7d3c99db785c40" & gt; & Lt; Input type = "hidden" name = "check [1]" value = "836251738362638404843399db785c40" & gt; ...  

getElementByName ("check") [0] .value only undefined returns. How do I get real values?

This method is named getElementsByName , and it is a < Code> nodistist .

Elements name check [0] and check [1] , there is no concept of elemental elements in HTML names, Is given the name.

So, at one time you can get the necessary values ​​to access objects. Note that to bring the element back you will have to use [0] , since it is always a list, even if there is only one element:

  var Check0 = document getElementsByName ('check [0]') [0] .Value; Var check1 = document.getElementsByName ('check [1]') [0]. value;  

1 comment:

  1. Can you like, at least check your spelling a little bit before you post?

    ReplyDelete