Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    add text to cell (DHTML)

    Help me. I add table to DHTML-edit, code:
    var pVar = document.ObjTableInfo;
    pVar.NumRows = 3;
    pVar.NumCols = 4;
    pVar.TableAttrs = 'border=1';
    pVar.CellAttrs = '';
    pVar.Caption = tit;
    obj_editor.ExecCommand(DECMD_INSERTTABLE,OLECMDEXECOPT_DODEFAULT, pVar);

    where ObjTableInfo is object, CLASSID="clsid:47B0DFC7-B7A3-11D1-ADC5-006008A5848C"
    I want create table with text in cells. How can I do it?

    I am sorry for my English.

  • #2
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It appears that the object has no metheds for that, as such, but exposes a DOM object, which can be used to manipulate data, etc.

    Here are some references that might help you:
    TD Element | td Object
    TABLE Element | table Object
    How to Build Tables Dynamically
    About the W3C Document Object Model

    DHTML Editing Component Constants (.vbs)

    ... and here's a simple test I did:
    Code:
    <html>
    <head>
    <title>-</title>
    
    <script type="text/JScript">
    
    function blah(){
    var DOM, tableAttributes, cellAttributes, ITP, oCells;
    
    DOM = DHTMLSafe.DOM;
    
    tableAttributes = 
    "border = 1 "     + 
    "frame = border " + 
    "rules = all "    + 
    "width = 100% "   + 
    "id = table1 ";
    
    cellAttributes = "align = center";
    
    ITP = new ActiveXObject("DEInsertTableParam.DEInsertTableParam");
    
    ITP.NumRows = 5;
    ITP.NumCols = 5;
    ITP.Caption = "Hello...";
    ITP.TableAttrs = tableAttributes;
    ITP.CellAttrs = cellAttributes;
    
    DHTMLSafe.ExecCommand(5022, 0, ITP);
    
    oCells = DOM.getElementById("table1").cells;
    
    for(var i = 0; i < oCells.length; i++){oCells[i].innerText = "blah";}
    }
    </script>
    
    <style type="text/css">
    div{text-align:center;margin:5px}
    .editBox{width:50%;height:50%}
    </style>
    
    </head>
    <body>
    
    <div>
    <object id="DHTMLSafe" class="editBox" 
    classid="clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A">
    
    <param name="ActivateApplets" value="0">
    <param name="ActivateActiveXControls" value="0">
    <param name="ActivateDTCs" value="-1">
    <param name="ShowDetails" value="0">
    <param name="ShowBorders" value="0">
    <param name="Appearance" value="1">
    <param name="Scrollbars" value="-1">
    <param name="ScrollbarAppearance" value="1">
    <param name="SourceCodePreservation" value="-1">
    <param name="AbsoluteDropMode" value="0">
    <param name="SnapToGrid" value="0">
    <param name="SnapToGridX" value="50">
    <param name="SnapToGridY" value="50">
    <param name="UseDivOnCarriageReturn" value="0">
    
    </object>
    </div>
    
    <div><button onclick="blah();this.disabled=1">Insert Table</button></div>
    
    </body>
    </html>
    Last edited by swmr; 03-29-2004 at 11:32 PM.
    hmm... ?

  • #3
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you


  •  

    Posting Permissions

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