Digital Point Forums
Winn Law Group

Go Back   Digital Point Forums > Design & Development > Programming > JavaScript
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old Jun 17th 2005, 2:33 am
ajithevn ajithevn is offline
Peon
 
Join Date: Jun 2005
Posts: 1
ajithevn is on a distinguished road
Question Problem with onKeypress

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
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Cristian Mezei Setup / Validation Help 7 May 22nd 2005 10:30 am
IE and FF problem, can anyone help? saintdw CSS 3 Mar 12th 2005 9:08 am
Still a problem. Owlcroft Setup / Validation Help 6 Jan 19th 2005 8:12 pm
Problem General Grant Setup / Validation Help 2 Dec 27th 2004 5:34 pm
Pr Problem alexo Websites 6 Aug 3rd 2004 7:36 am


All times are GMT -8. The time now is 7:18 am.