Solved

Dom setAttribute ondblclick & ID for Table row/cell

Posted on 2001-09-02
3
608 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now