Hi I'm in great trouble plz anybody help me.I have an asp page where i'm using onkeypess function now i want to give a condition like if the numerical number entered is greater than 24 i have to give an alert msg. im also creating dynamic rows on an onclick function and textboxes are created in the dynamic rows how can i add an onkeypress function to those textboxes and also the condition like the value entered should not b greater than 24.Plz suggest any ideas Pleeeeeeeeezzzzzzzz i'm in greate trouble plz. i'm adding the code below plz ckeck it and help. /*---------------------------CODE------------------------------*/ <html> <body> <form name="user" action="tableaddrow.asp" method="post"> <input type="button" value="Add" onclick="addRowToTable();"> <input type="submit" value="Submit"> <table border="1" id="tblSample"> <tr> <th colspan="2">Sample table</th> </tr> <tr> <td>1</td> <td><input type="text" name="txtRow1" onKeypress="fndisn()" ></td> </tr> </table> </form> </body> <script> function addRowToTable() { var tbl = document.getElementById('tblSample'); var lastRow = tbl.rows.length; //if there's no header row in the table,then iteration=lastrow+1 var iteration = lastRow; var row = tbl.insertRow(lastRow); // left cell var cellLeft = row.insertCell(0); var textNode = document.createTextNode(iteration); cellLeft.appendChild(textNode); // right cell var cellRight = row.insertCell(1); var el = document.createElement('input'); el.setAttribute('type', 'text'); el.setAttribute('name', 'txtRow' + iteration); el.setAttribute('id', 'txtRow' + iteration); el.setAttribute('size', '40'); cellRight.appendChild(el); } function fndisn() { if((event.keyCode > 64 && event.keyCode < 91) || (event.keyCode > 96 && event.keyCode < 123)) event.returnValue= false; } </script> </html> Thanks