Re: getElementByName within containing DIV



Thanks Joost and George-
Joost- yes youre right about my error in placing the code here- I
meant:

Id like to do the following (input-->inputbox):

function HmmFunc(ref)
{
var moo = ref.parentNode.id;
var x=document.getElementById(moo).getElementByName('inputbox');
x.value = "newvalue"
}

But the reason my solution isnt great is that I already know the input
control I want as long as I know the div that it is within (which I
do)- it seems crazy to have to create an array of all tagnames ie all
<input> elements and then extract the one I want. In the scenario
there may be 10 inputs and 10 similar (though uniquely id'd) divs: I
want a handle on an input where name="inputname" so I can populate it-
I am not interested in the other input boxes within the div. The
input of course has a unique id but Id like to use the same function
so that it is passed the div it is within and can find the appropriate
select box to populate...
.



Relevant Pages

  • Re: getElementByName within containing DIV
    ... var moo = ref.parentNode.id; ... while(ref.tagName!= 'DIV') ref = ref.parentNode; ... - getElementByName ...
    (comp.lang.javascript)
  • Re: getElementByName within containing DIV
    ... var moo = ref.parentNode.id; ... I cant figure out why I cant search within ... a div for a child element with a specified name to get a control. ... IOW, don't make stuff up and expect it to work. ...
    (comp.lang.javascript)
  • Re: Another float/clear bug in IE 6+?
    ... In my opinion, Internet Explorer is directly violating rule #5, by ... placing the outer top of div 3 above the outer top of div 2. ...
    (comp.infosystems.www.authoring.stylesheets)
  • Setting a style for multiple table cells
    ... multiple table cells instead of placing a "div" in each cell? ...
    (comp.infosystems.www.authoring.stylesheets)