Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 21st, 2007, 02:30 PM
Authorized User
 
Join Date: May 2007
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default Navigation DOM: getElementByID()

I am trying to navigate to a specific row using multiple getElementByID()s:

<table id="tbl1">
  <tr id="r1"></tr>
  <tr id="r2"></tr>
</table>

<table id="tbl2">
  <tr id="r1"></tr>
  <tr id="r2"></tr>
</table>

Is it possible to navigate using:

document.getElementById('tbl2').getElementById('r1 ');

 
Old November 21st, 2007, 03:17 PM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

i would jst use

var sTableData
sTableData = document.getElementById('idname').innerHTML

Or

doucment[tablenanme].getElementById .. . . .

But if you look hard enough on the web say w3schools.com they show you how to manipulate tables using javascript!

Happy Coding,


------------------------------------------------
Apocolypse2005
Always ready and waiting to be helped!
 
Old November 22nd, 2007, 04:04 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The reason you need to do this is because your document is invalid according to the HTML specs, IDs should be unique throughout the document.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using typeOf with getElementById() atcs2152 Javascript 2 December 16th, 2005 08:19 AM
Using getElementById Frank Huddleston XML 4 November 11th, 2005 01:44 PM
getElementByID error lian_a Javascript How-To 1 December 21st, 2004 01:42 AM
'getElementById()' anshul Javascript How-To 1 September 1st, 2004 03:57 PM
document.getElementById(). PKC XSLT 0 July 21st, 2004 02:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.