Dynamic table using JScript

A

Al

Hi,
I am trying to add rows to a table dynamically, using JScript. Can I someone
explain, how to add events to the newly added cells/ rows? Following code
does not fire the onmousemove event.

Thanks in advance,
Alwin S.

newRow = tblResults.insertRow();
newCell = newRow.insertCell();
newCell.innerHTML = rsX("Title").Value;
newCell.onmousemove = "javascript:alert(1);";
 
M

Martin Honnen

Al said:
I am trying to add rows to a table dynamically, using JScript. Can I someone
explain, how to add events to the newly added cells/ rows? Following code
does not fire the onmousemove event.

newRow = tblResults.insertRow();
newCell = newRow.insertCell();
newCell.innerHTML = rsX("Title").Value;
newCell.onmousemove = "javascript:alert(1);";

Not an ASP problem it seems. An event handler in client side JavaScript
is a function object so you need to use one of the ways the language
offers to create one, the most elegant being a function expression
newCell.onmousemove = function (evt) {
alert('...');
};
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top