View Full Version : add text to cell (DHTML)

03-19-2004, 03:27 PM
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;

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.

03-20-2004, 01:14 AM
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 (http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/td.asp)
TABLE Element | table Object (http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/table.asp)
How to Build Tables Dynamically (http://msdn.microsoft.com/workshop/author/tables/buildtables.asp)
About the W3C Document Object Model (http://msdn.microsoft.com/workshop/author/dom/domoverview.asp)

DHTML Editing Component Constants (.vbs) (http://www.branz.org.nz/~branz/scripts/editor/Inc/dhtmled.vbs)

... and here's a simple test I did:


<script type="text/JScript">

function blah(){
var DOM, tableAttributes, cellAttributes, ITP, oCells;


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";}

<style type="text/css">


<object id="DHTMLSafe" class="editBox"

<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">


<div><button onclick="blah();this.disabled=1">Insert Table</button></div>


03-22-2004, 01:38 PM
thank you :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum