posted 17 years ago
hello, i am having trouble adding onkeypress event to my document using javascript. you see, i already have this function checkError (widget, x, y). this already works well with all my other forms (input) in my html file:
<tr><td>
<INPUT TYPE="TEXT" ONKEYPRES="checkError(this,5,5)" /> (this input is within a table)
</td></tr>
i wanted to add to my table dynamically so what i did was:
var x = document.getElementById('table_1').insertRow (document.getElementById('table_1').rows.length);
var img = x.insertCell (0);
var iteration = x.insertCell (1);
iteration.innerHTML = '<td>iterations: <br> <input> </input></td>';
the problem is, i want to put an onkeypress event on my input element. i'm trying to do this:
iteration.onkeypres = checkIterationError(this,5,5);
but it doesn't work. what should i do? thanks!!! i really need help on this one. thanks.