24 posts

Web developer cannot live without JavaScript.

[JavaScript] ASP.NET Tooltip Alternative

Tooltip is a very nice feature in ASP.NET for displaying additional information when hovering mouse over an item, but the problem with tooltip is that it will go away after about 2 seconds and you will have to move your mouse away and move back to make it appear again. You don’t have any option to change the duration of the display either. It really irritates me for not being able to keep the tooltip […]

[JavaScript] CheckAll/CheckNone CheckBox in GridView

GridView or DataGrid only allows you to delete one row each time and it becomes inefficient and tedious if there are multiple rows need to be deleted. In this post, I will demo how to add a check box in front of each row and also a check box in the header of the grid to check/uncheck all check boxes, then with a delete button to delete those checked rows in a batch mode. I […]

[JavaScript] Force user to check a box before clicking a button

This has been used a lot on those “sign up” forms. User has to select a check box indicating “I read and agree to the license agreement”, or something like that, before he/she can submit the form. Of course, with ASP.NET, you can let user submit the form and then check the state of the check box in the Button.Click event handler to prompt the user if the check bos is not checked. But my […]

[JavaScript]Clear the content of a textbox when it gets the focus

(I truly believe that a professional Web developer cannot live without JavaScript, and I have been busy playing with JavaScript lately and I will post some common but useful JavaScript code here.) Here is the JavaScript code: <script language=”javascript” type=”text/javascript”>        function clearBox(id)         {            var txt = document.getElementById(id);            if (txt.type != “text”)            {              alert(“Error: parameter type mismatch in clearBox function. TextBox type expected.”);            }            else           {                […]