Solved

Dom setAttribute ondblclick & ID for Table row/cell

Posted on 2001-09-02
3
617 Views
Last Modified: 2006-11-17
Hi,

How do I add an onDblClick event for each table TR being created & how do I add an ID for each Cell being created.

function addRow(val1,val2)
{
tabBody = document.getElementsByTagName("TBODY").item(3);
row = document.createElement("TR");
cell1 = document.createElement("TD");
cell2 = document.createElement("TD");
textnode1 = document.createTextNode(val1);
textnode2 = document.createTextNode(val2);
cell1.appendChild(textnode2);
cell2.appendChild(textnode1);
row.appendChild(cell1);
row.appendChild(cell2);
tabBody.appendChild(row);
}

0
Comment
Question by:kingasa
  • 3
3 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6448746
row.onclick = function { /* code here */ }

row.id = "id_here";


:o)

Ant
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6448752
Sorry, make that:

row.onclick = function() { /* code here */ }


Ant
0
 
LVL 15

Accepted Solution

by:
a.marsh earned 50 total points
ID: 6448756
Let's get this right!

row.ondblclick = function() { /* code here */ }

and

cell1.id = ""id_here";

etc.

Ant
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question