Jan 6, 2011

How to press enter key


<script type="text/javascript">
function onclickbtn(buttonName,e)
{
//the purpose of this function is to allow the enter key to
//point to the correct button to click.
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //Firefox
if (key == 13)
{
var btn = document.getElementById(buttonName); //Get the button the user wants to have clicked
if (btn != null)
{ //If we find the button click it
btn.click();
event.keyCode = 0
}
}
}
</script>

---------------------------------------------------------------------

In Html
<input name="ctl00$ContentPlaceHolder1$pwd" type="password" id="ctl00_ContentPlaceHolder1_pwd" onKeyPress="onclickbtn('ctl00_ContentPlaceHolder1_LoginBtn1',event)" style="width:75%;" /></td>

No comments:

Post a Comment

What is the use of n-tier architecture and 3-tier architecture?

how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...