Friday, January 11, 2008

javascript function for invoking button click event

<html xmlns="" >
<head runat="server">
<title>javascript function for invoking btnclick event</title>
<script language="javascript" type="text/javascript" >
function TrigButton()
if(window.event.keyCode == 13)
if(document.getElementById('txt').value.length > 0)
<form id="form1" runat="server">
<asp:TextBox ID="txt" runat="server" Style="z-index: 105; left: 41px; position: absolute;
top: 141px" onkeydown="TrigButton()" ></asp:TextBox>
<asp:Button ID="bt" runat="server" Style="z-index: 107; left: 205px; position: absolute;
top: 142px" Text="Button" OnClientClick="javascript:alert('Button Triggered');" OnClick="bt_Click"/>

1 comment:

muthukumaran said...

good example. helped me to fix the problem. thanks