戰地連結︰ Home My Flickr NBA.com About

2009年2月14日星期六

Cannot view the contents of a (.chm) file

Overview

I just get an e-book and find that all of the pages are dead. With some searching I find that the file is blocked by windows.

The solution is to unlock the .chm file. To do this:

  1. Right-click on the .chm file, select "Properties"
  2. Click "unlock"
  3. Done!

Reference

解决打开CHM格式文件出现“网页不能浏览”错误的方法

You cannot open HTML Help files....

2009年2月5日星期四

Add a select / deselect all checkbox to an ASP.NET checkbox list control

Overview

The code below demonstrate how to use JavaScript to get all the checkbox elements of a particular checkbox list, and then check / unchecked them base on the status of another checkbox (the sender).

This technique is also useful when you want to do other operation (e.g. ensure single selection) to all checkboxes of a checkbox list.

Reference

Check/Uncheck all items in a CheckBoxList using ASP.NET and Javascript

Code Snippet

This code is directly copied from Check/Uncheck all items in a CheckBoxList using ASP.NET and Javascript

function CheckBoxListSelect(cbControl, state)

{  

    var chkBoxList = document.getElementById(cbControl);

    var chkBoxCount= chkBoxList.getElementsByTagName("input");

    for(var i=0;i<chkBoxCount.length;i++)

    {

        chkBoxCount[i].checked = state;

    }

 

    return false;

}

2009年2月3日星期二

Multi-line Text boxes (Text area) behave incorrectly with Default Button in Firefox

Overview

I open form with a default button and a Multi-line ASP.NET text box (text area) in Firefox 3. When I hit "Enter" key in the text area, I expect the text area to start a new line. However, the default button is triggered.

Reference

Multiline Textboxes and DefaultButton in Firefox