row.onClick="alert()" when building table using javascript

var row = table.insertRow(0);
row.className = "lb"
row.vAlign="top"
row.onClick="alert()"

i'm trying to modify a table and include an onClick event handler, as far as i can tell this should work

any ideas
steve_steeleAsked:
Who is Participating?
 
cLFlaVACommented:
Just a suggestion:

You should use the all-lowercase versions of the event handlers:

row.onclick = function() {alert();}
0
 
boblahCommented:
Hi steve_steele,

try

row.onClick=function(){alert();}


Cheers!
0
 
boblahCommented:
steve_steele,

or, if you want to make use of the event arguments:

row.onClick=function(e){alert();}
0
 
steve_steeleAuthor Commented:
that sorted it thank you very much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.