Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. mozilla not recognising childnodes-getting console error

mozilla not recognising childnodes-getting console error

Scheduled Pinned Locked Moved .NET (Core and Framework)
helphtmlsysadminquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    balaji t
    wrote on last edited by
    #1

    Dear sir, I have created controls dynamically and the controls are inside the table and the table inside the div.Im getting error in mozilla browser.. The sample html generated code is shown below <div id=divall runat="server">

    sdfssdf

    <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

    sdfssdf

    <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

    sdfssdf

    <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

    I access the value as below var divall = document.getElementById('divall'); //for getting all the controls inside the div var allcntr = divall.childNodes[0].childNodes[0].childNodes; for(var i=0;i<allcntr.length;i++)> { //for getting all the dropdownlist's value inside the table var cmball=divall.childNodes[0].childNodes[0].childNodes[i].getElementsByTagName('OPTION'); for(var j=0;j<cmball.length;j++)> { if(cmball[j].selected) { //some code } } } // divall.childNodes[0].childNodes[0].childNodes; The above code is working 5n in IE but not in mozilla. Is there any common code(compatible to all browsers mainly IE & Mozilla) to access the childnodes? Thanx for your help in advance..

    T.Balaji

    D T 2 Replies Last reply
    0
    • B balaji t

      Dear sir, I have created controls dynamically and the controls are inside the table and the table inside the div.Im getting error in mozilla browser.. The sample html generated code is shown below <div id=divall runat="server">

      sdfssdf

      <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

      sdfssdf

      <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

      sdfssdf

      <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

      I access the value as below var divall = document.getElementById('divall'); //for getting all the controls inside the div var allcntr = divall.childNodes[0].childNodes[0].childNodes; for(var i=0;i<allcntr.length;i++)> { //for getting all the dropdownlist's value inside the table var cmball=divall.childNodes[0].childNodes[0].childNodes[i].getElementsByTagName('OPTION'); for(var j=0;j<cmball.length;j++)> { if(cmball[j].selected) { //some code } } } // divall.childNodes[0].childNodes[0].childNodes; The above code is working 5n in IE but not in mozilla. Is there any common code(compatible to all browsers mainly IE & Mozilla) to access the childnodes? Thanx for your help in advance..

      T.Balaji

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      And this has what to do with the .NET Framework?? Ask this in the Web Developement forum.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      1 Reply Last reply
      0
      • B balaji t

        Dear sir, I have created controls dynamically and the controls are inside the table and the table inside the div.Im getting error in mozilla browser.. The sample html generated code is shown below <div id=divall runat="server">

        sdfssdf

        <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

        sdfssdf

        <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

        sdfssdf

        <select id=dd1> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> <option value="1">sdfsd</option> </select>

        I access the value as below var divall = document.getElementById('divall'); //for getting all the controls inside the div var allcntr = divall.childNodes[0].childNodes[0].childNodes; for(var i=0;i<allcntr.length;i++)> { //for getting all the dropdownlist's value inside the table var cmball=divall.childNodes[0].childNodes[0].childNodes[i].getElementsByTagName('OPTION'); for(var j=0;j<cmball.length;j++)> { if(cmball[j].selected) { //some code } } } // divall.childNodes[0].childNodes[0].childNodes; The above code is working 5n in IE but not in mozilla. Is there any common code(compatible to all browsers mainly IE & Mozilla) to access the childnodes? Thanx for your help in advance..

        T.Balaji

        T Offline
        T Offline
        Tarun K S
        wrote on last edited by
        #3

        Well i had read in the w3schools.com that there is a small issue in accessing the childnodes.

        balaji.t wrote:

        divall.childNodes[0].childNodes[0].childNodes;

        This works fine in IE but not in Firefox. The reason which i am not completely sure is that IE accesses with '0' index and '1' in Firefox. So just try by using 1 instead of 0 for accessing.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups