Posted on May 30th, 2008%
I was looking around for a good HTML combo box (a drop-down list with a type-in text box), and found a good looking one over at Particletree (see Update Your Select Element to a Combo Box). There were a few quirks I found with it.
The text box used absolute positioning. As a result, if the location of the select element changed (perhaps due to another item on the page being shown or hidden), the text box would be in the wrong place.
The code was free-standing and applied event handlers directly, instead of using an event manager like one offered in Prototype‘s Event class.
To clean things up, I modified the code to work with the Prototype JavaScript library, converting element selectors and event management. I also added a hack to handle positioning issues by calling a routine that repositions the text box every 0.05 seconds. Though far from efficient, it didn’t cause any flickering or processor utilization. If JavaScript . . .
→ Read More: Select/input combo box using Prototype
Posted on November 8th, 2007%
Recently I’ve stepped away from the MonoRail world to work on a project that uses ASP.Net WebForms. It didn’t take long before I found an annoying problem. (Actually I found many annoying problems, but I’ll focus on one here.)
The <ASP:Panel> control has a DefaultButton property which, according to the documentation, "Gets or sets the identifier for the default button that is contained in the Panel control." In other words:
Use the DefaultButton property to indicate which button gets clicked when the Panel control has focus and the user presses the ENTER key.
It works perfectly, if you’re not using a LinkButton control. Actually, that’s not true; if you use a LinkButton control and Internet Explorer, it works fine. It just doesn’t work in Firefox. Why?
Dmytro Shteflyuk outlines why in his blog post, Using Panel.DefaultButton property with LinkButton control in ASP.Net. Apparently, it’s an issue with the JavaScript code that Microsoft generates, which expects a click() method on the anchor (i.e. . . .
→ Read More: Firefox, LinkButtons, and the Panel.DefaultButton: a (Prototype) fix
Posted on July 13th, 2005%
A fantastic Web page called Styled Checkboxes describes how to use CSS and JavaScript to create graphical checkboxes and radio buttons that depreciate to the standard checkbox and radio button HTML controls when CSS or JavaScript is turned off. It works, too – and is definitely worth checking out as a way to pretty up your Web pages.
A unique idea? Not really, but it’s one of the first times I’ve seen it written up and packaged in one place.
. . .
→ Read More: Styling your checkboxes and radio buttons
Posted on January 30th, 2005%
A client recently asked me if there was any way to notify visitors to their Web site that their session was about to expire. Fortunately, there’s an easy way to do this using JavaScript.
First, add the following code block to your standard JavaScript include file. (You are using an included file for your JavaScripts, aren’t you?) Essentially, you want the following piece of JavaScript code to be available on each page:
function ShowTimeoutWarning ()
{
window.alert( "You will be automatically logged out in five minutes unless you do something!" );
}
That little function does nothing more than show a popup message to the user. The text of the message (and the five minutes) duration is arbitrary; you can make them whatever you want.
How will we invoke the popup? By using a simple JavaScript function called setTimeout. Pass two parameters to this function: the name of another JavaScript function to call, and the amount of time to wait (in . . .
→ Read More: Friendly Session Timeouts, the JavaScript Way