getElementsByTagName

All we know that getElementsByTagName() a DOM function in Javascript is used to get all the child elements for an particular element.Consider this following scenario I have an table with the id as “parentTable”, which has many child tables in it. so my structure will be like this,
			<table id='parentTable'>
				<tr>
					<td>
						<table id='childTable1'>
							<tr>
								<td>My First Article</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		
If i’m going to use parentTable.getElementByTagName(”tr”), i’ll be getting the count as 2, Which is what i’m not looking for. I wanted to get the count as 1.Guys please give some alternative suggesstion.
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Tags: ,

Leave a Reply

Name and Email Address are required fields. Your email will not be published or shared with third parties.

Get Adobe Flash player