getElementById() is an Document object method, doesn't belong to
Element object, so can not use it as Element.getElementById();

maybe you can do it like this (without jQuery):

var children = document.getElementById('001').childNodes;
for(var i=0;i<children.length;i++){
if(children[i].id=='0011'){
alert(children[i].innerHTML);
break;
}
}

On 6/1/07, Mark <[EMAIL PROTECTED]> wrote:
> Could you also post the non jquery code? (i just would like to know :))
>
>
> 2007/6/1, Juha Suni <[EMAIL PROTECTED]>:
> >
> >
> > Well id's really should always be unique. But if you really want to do
> this, try:
> >
> >
> > alert($('#001').children('#0011').html());
> >
> >
> >
> > ----- Original Message -----
> > From: Mark
> > To: jquery-en@googlegroups.com
> > Sent: Friday, June 01, 2007 5:22 PM
> > Subject: [jQuery] Javascript question: Get elementid inside an element
> >
> >
> > Hey,
> >
> > For example take this code:
> >
> > <div id="001">
> >
> >     <div id="0010">
> >     </div>
> >
> >     <div id="0011">
> >     </div>
> > </div>
> >
> > Now i want to have the InnerHtml of id 0011
> > one way to do that is: document.getelementbyid('0011');
> >
> > But that id COULD be in more places.. (i know it`s not good for id`s.. but
> in some cases it`s possible)
> >
> > So how do i get the id: 0011 without the document thing?
> > i tried this:
> >
> > var test = document.getelementbyid('001');
> > alert(test.getelementbyid(0011).InnerHtml);
> >
> > but that isn`t working.
> >
> > I hope someone could help me with this. (above code is not tested)
> >
> > Thanx in favor,
> > Mark
>
>


-- 
Zacky Ma
www.marchbox.com
www.DisneyBox.com
www.flickr.com/photos/marchbox

Reply via email to