Solved

Dom setAttribute ondblclick & ID for Table row/cell

Posted on 2001-09-02
3
604 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
Comment Utility
row.onclick = function { /* code here */ }

row.id = "id_here";


:o)

Ant
0
 
LVL 15

Expert Comment

by:a.marsh
Comment Utility
Sorry, make that:

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


Ant
0
 
LVL 15

Accepted Solution

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

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

and

cell1.id = ""id_here";

etc.

Ant
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

762 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

10 Experts available now in Live!

Get 1:1 Help Now