Dynamic table using JScript

Discussion in 'ASP General' started by Al, Jan 17, 2004.

  1. Al

    Al Guest

    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);";
     
    Al, Jan 17, 2004
    #1
    1. Advertising

  2. Al wrote:

    > 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('...');
    };
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jan 17, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Maz
    Replies:
    4
    Views:
    1,295
    Jon Maz
    Sep 9, 2004
  2. Maxwell2006
    Replies:
    5
    Views:
    2,424
    Steven Cheng[MSFT]
    Mar 7, 2006
  3. John Bentley
    Replies:
    14
    Views:
    372
    Jim Ley
    Feb 5, 2004
  4. VK
    Replies:
    4
    Views:
    369
    Thomas 'PointedEars' Lahn
    Jan 12, 2006
  5. Eran
    Replies:
    1
    Views:
    306
Loading...

Share This Page