Closed Thread Icon

Topic awaiting preservation: DHTML Tables Pages that link to <a href="https://ozoneasylum.com/backlink?for=8859" title="Pages that link to Topic awaiting preservation: DHTML Tables" rel="nofollow" >Topic awaiting preservation: DHTML Tables\

 
Author Thread
aXi
Obsessive-Compulsive (I) Inmate

From:
Insane since: Sep 2003

posted posted 09-16-2003 02:12

First of all i would like to thank in advance anyone who will post anything helpful in reply to my problem. Seeing work of ppl here on forum I was kind of ashmed to post this... so plz don't make too much joke out of me .

Now, the problem is that I can't get DHTML tables to work fine. You can get the point what i want to do from just looking at the source code (you can find html with same code on this link - http://www.clan-g.com/aXi/table.html):

-----
<BUTTON onclick='javascript:InsertTable();space.focus();'
unselectable="on" align="center">Insert Table</BUTTON>
<BUTTON onclick='javascript eleteCell();space.focus();'
unselectable="on" align="center">Delete Cells</BUTTON>
<BUTTON onclick='javascript eleteRow();space.focus();'
unselectable="on" align="center">Delete Row</BUTTON>
<BR>

<DIV id=space contentEditable=true style="BORDER-RIGHT: darkblue 1px solid; BORDER-TOP: darkblue 1px solid; BORDER-LEFT: darkblue 1px solid; WIDTH: 500px; BORDER-BOTTOM: darkblue 1px solid; HEIGHT: 500px"></DIV>

<script language="JScript">
var oTable = space.document.createElement("Table");
var oRow, oCell, curr_row;

function InsertTable()
{
oTable.border = 1;
oTable.width = 75;

oRow = oTable.insertRow();
oRow.insertCell();
oRow.insertCell();
oRow.insertCell();
oRow = oTable.insertRow();
oRow.insertCell();
oRow.insertCell();
oRow.insertCell();
oRow = oTable.insertRow();
oRow.insertCell();
oRow.insertCell();
oRow.insertCell();

space.appendChild(oTable);
}

function DeleteRow()
{
oTable.deleteRow();
}

function DeleteCell()
{
for (curr_row = 0; curr_row < oTable.rows.length; curr_row++)
{
oTable.rows[curr_row].deleteCell();
}

}
</script>
-----

It's obvious what I want to do - to be able to bind scripts to buttons so I can with single click insert table and then delete it's cells or rows. Problem is - I can't insert rows or cells there where I WANT THEM or where currently mouse cursor is, DHTML with it's commands adds or deletes cells/rows on the end of table and that's it. I know that somehow I should include some what_is_selected but i do not know DHTML&JScript good so this is all I could make.

Also there are some other problems:
1. I can't get two tables inserted (my guess is that problem is var oTable outside of InsertTable function... but I need it there for DeleteRow and DeleteCell functions, or not?). Of course I want table to be inserted where cursor currently is...
2. DeleteCell do not work properly when there are no rows left... it leaves one row and then inserting new table makes problem (extra row with no cells).
3. I can't get InsertRow() and InsertCell() to work properly so i left them out. If someone can help me to make them to work in same manner like DeleteRow() and DeleteCell() - to add insted to delete line of cells/row there where curser resides that would help me a lot also.
4. It would be cool if someone gived me a hint on how to enable/disable buttons for inserting/deleting rows/cells depending on fact is table selected or is it not.

Once again tnx for any help. If it is easier, you can mail me at pele@beotel.yu.

c-ya guys...

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 09-17-2003 08:28

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu