I need to use an OnFocus event of a textbox in ASP.Net.
<asp:TextBox ID="TBAccountNum" runat="server" CssClass="textbox" Height="12px" Width="100px" Font-Size="Small" AutoCompleteType="None" Wrap="False" OnFocus="Validator()" OnTextChanged="TBAccountNum_OnLeave" AutoPostBack="true"></asp:TextBox>
The only way to do that is to use Javascript, which I know nothing about. I found this little piece of code on SO that looks like it should work:
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
<script type="text/javascript">
function Validator()
{
document.getElementsByName("btnValidateWork").style.visibility = "visible";
document.getElementsByName("btnSubmitWork").style.visibility = "hidden"
}
However, when I run it I get the following error:
0x800a138f - Microsoft JScript runtime error: Unable to set value of the property 'visibility': object is null or undefined
Any ideas what I'm doing wrong (besides trying to write code I know nothing about... :oP )?
All relevant code has now been posted. I'm using IE9 on an Intranet (mandated by the company, so that can't change) if that matters.