SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Threaded View

  1. #1
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Navigating the IE vs Netscape DOM

    I just made an observationg that troubled me. I guess because IE once again has its own variations this works or Netscape isn't following the dom I don't know which but I was hoping this type of navigation was going to be dom compliant with the newest versions of Netscape

    If you have a table with the id "bob" (I like dumb names sometimes) you should be able to navigate down the table via bob.firstChild.childNodes[1].innerHTML. This does not work in netscape but does work in IE. I find this troubling because of how much easier things would have been if it worked in both. I really just wish the browsers would become equal.

    The dom specification is here (outdated I believe)
    http://www.w3.org/TR/1999/CR-DOM-Lev...roduction.html

    Thats the specification and how it supposedly works. I am going to keep playing and figure out if maybe Netscape 'changed' it. for an example try this

    An example of how it works:
    <table width="75%" border="1" id="bob">
    <tr>
    <td>row 1 col1</td>
    <td>row1col2</td>
    </tr>
    <tr>
    <td>row2col1</td>
    <td>row2col2</td>
    </tr>
    <tr>
    <td>row3col1</td>
    <td>row3col2</td>
    </tr>
    <tr>
    <td>row4col1</td>
    <td>row4col2</td>
    </tr>
    </table>

    To navigate using the dom you should be able to do something like this

    (this part goes in the head with an onload from the body)

    function test(){
    alert(bob.firstChild.innerHTML)
    }

    that will show you the whole table. This nice thing about navigation this way is the removal of the need to id everything. So I could very easily do

    alert(bob.firstChild.childNodes[0].childNodes[0].innerHTML)

    This will show you row1col2. DHTML affects (such as changing background in table elements) would be more convenient (I would think anyways)

    Anyways just ranting sorry to waste anyones time.
    Last edited by Maelstrom; Nov 10, 2001 at 00:15.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •