appendChild to div tag problem in firefox.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MoorthiDaniel
    New Member
    • Nov 2006
    • 5

    appendChild to div tag problem in firefox.

    i need to display the data in grids like msflexgrid in vb. so i wrote the following code. the problem is it works fine under ir but not in firefox. help me.


    <html>
    <head>
    <title>Gettin g Sticky</title>

    <script type="text/javascript">

    var iC =0 , iR = 0 ;
    var tblWidth =0 ,tblheight = 0 ,tblColspan =0,tblRowspan =0;

    function addCell(){
    tblheight = "20";tblWid th = "50"; tblColspan = "2";tblRows pan = "1";
    mainDivElement = document.getEle mentById("huti" );
    newNote = document.create Element("div");
    newNote.setAttr ibute("id", "note" + iC);
    newNote.style.w idth = tblColspan * tblWidth ;
    newNote.style.h eight = tblRowspan * tblheight;
    newNote.style.b order ="1px ridge";
    // newNote.style.b orderleft = "0";
    newNote.style.b ackgroundColor= "#cccccc";
    newNote.style.p osition="absolu te";
    newNote.style.t op = parseInt(tblRow span * iR * 21) + 'px';
    newNote.style.l eft= parseInt(tblCol span * iC * 50) + 'px';
    mainDivElement. appendChild(new Note);

    newNote.innerHT ML = iC;
    newNote.setAttr ibute('align',' center');
    iC++;

    }
    function addRow() {
    iR++;iC=0;
    }
    </script>



    </head>
    <body style="backgrou nd-image:url(../ba.gif)">
    <form id="noteForm">
    <input type="button" value="Add Cell" onClick="addCel l()"/>
    <input type="button" value="Add Row" onClick="addRow ()"/>
    </form>
    <div id="huti" style="border:1 #000099 solid;overflow: auto;height:250 ;width:50%;back ground:#FFFFFF" >Digitech</div>
    </body>
    </html>
  • b1randon
    Recognized Expert New Member
    • Dec 2006
    • 171

    #2
    Originally posted by MoorthiDaniel
    i need to display the data in grids like msflexgrid in vb. so i wrote the following code. the problem is it works fine under ir but not in firefox. help me.


    <html>
    <head>
    <title>Gettin g Sticky</title>

    <script type="text/javascript">

    var iC =0 , iR = 0 ;
    var tblWidth =0 ,tblheight = 0 ,tblColspan =0,tblRowspan =0;

    function addCell(){
    tblheight = "20";tblWid th = "50"; tblColspan = "2";tblRows pan = "1";
    mainDivElement = document.getEle mentById("huti" );
    newNote = document.create Element("div");
    newNote.setAttr ibute("id", "note" + iC);
    newNote.style.w idth = tblColspan * tblWidth ;
    newNote.style.h eight = tblRowspan * tblheight;
    newNote.style.b order ="1px ridge";
    // newNote.style.b orderleft = "0";
    newNote.style.b ackgroundColor= "#cccccc";
    newNote.style.p osition="absolu te";
    newNote.style.t op = parseInt(tblRow span * iR * 21) + 'px';
    newNote.style.l eft= parseInt(tblCol span * iC * 50) + 'px';
    mainDivElement. appendChild(new Note);

    newNote.innerHT ML = iC;
    newNote.setAttr ibute('align',' center');
    iC++;

    }
    function addRow() {
    iR++;iC=0;
    }
    </script>



    </head>
    <body style="backgrou nd-image:url(../ba.gif)">
    <form id="noteForm">
    <input type="button" value="Add Cell" onClick="addCel l()"/>
    <input type="button" value="Add Row" onClick="addRow ()"/>
    </form>
    <div id="huti" style="border:1 #000099 solid;overflow: auto;height:250 ;width:50%;back ground:#FFFFFF" >Digitech</div>
    </body>
    </html>
    I'm seeing cells and rows in Firefox, what is broken?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      It works fine in Firefox if I add rows and cells. It starts from the top of the page. What didn't work in Firefox?

      Comment

      • MoorthiDaniel
        New Member
        • Nov 2006
        • 5

        #4
        it work but i need like grid (MsFlexgrid in vb). it fine in ie, but in firefox it append at the top of the page. i want to append it in div tag

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Originally posted by MoorthiDaniel
          it work but i need like grid (MsFlexgrid in vb). it fine in ie, but in firefox it append at the top of the page. i want to append it in div tag
          You have the following in your code:
          Code:
          newNote.style.position="absolute";
          Change it to
          Code:
          newNote.style.position="relative";

          Comment

          • MoorthiDaniel
            New Member
            • Nov 2006
            • 5

            #6
            thank u friends

            Comment

            Working...