Javascript

ASP.NET CSS Highlight TextBox on Focus

Many sites have a useful visual way to show the user what TextBox (input text control) is currently focused or selected by highlighting the background of the control with a color such as yellow. When you tab or click into the TextBox, the border and background usually change to denote it has focus.

Here is what the TextBox should look like when it is focused and unfocused after applying this trick:

Un-Focused TextBox
unfocused textbox

Fix for Firefox click() event issue

Firefox does not support the javascript click() event on a hyperlink. So doing something like:

<asp:LinkButton ID="lnkMyButton" runat="server">My Button To Click</asp:LinkButton>
 
<a href="#" onclick="document.getElementById('lnkMyButton').click();">Click this to click the other link!</a>

Internationalize / Localize ASP.NET Javascript

I ran across an interesting presentation today on how to internationalize javacripts in ASP.NET. The presentation was given in January 2008 by Guy Smith-Ferrier and is a continuation based on his article in MSDN Magazine from January 2008 called Around the World with ASP.NET AJAX Applications.

You can download it as a PDF here.