function setCheckBox_Checking(a_TableID)
{
 /*
 Function    : 將 Table 裡的 Checkbox 全選或全不選
 Description : 使用於 Table 下的整行選取(DataGrid 也可使用),第一列不選
 Arguments   : [1]=[true/false] (選擇否),
               [2]=[0/number] (選擇 checkbox 在的欄位)
 Date        : 2006/6/21
  */
 var obj = document.all[a_TableID];
 var oRow = null; //obj.rows[obj.rows.length-1]; 
 var oCell = null; //obj.rows[0].cells[0]; 
 var oChkCell = null;   
 var oItem = null; 
 var iCellCount = 0;
 //
 // 辨斷傳入的參數
 var bChecked,iCol;
 if (arguments[1] == null) bChecked = true;
 else       bChecked = arguments[1];
 if (arguments[2] == null) iCol = 0;
 else       iCol = arguments[2];

 //lert(asStartPNo);
 var iRow = obj.rows.length;
 for(var i = 0 ; i < iRow ; i++)
 {
  oRow = obj.rows[i];
  iCellCount = oRow.cells.length;
  //  
  if(iCol <= iCellCount ){  // 設定欄只能小於總欄
   oChkCell = oRow.cells[iCol];
   oItem = oChkCell.childNodes.item(0);   
   // 辨斷是否為 Checkbox
   if(oItem.toString() == "[object]" && oItem.type.toLowerCase() == "checkbox" )
    oItem.checked = bChecked;  
  }
 }
}

felixhuang 發表在 痞客邦 留言(0) 人氣()

在.NET 2.0 之後,你可以直接輸出民國的日期格式:

例:
using System.Globalization;

TaiwanCalendar twC = new TaiwanCalendar();                   
string tdate = "民國 " + twC.GetYear(dDate) + "/" + twC.GetMonth(dDate) + "/" + twC.GetDayOfMonth(dDate);

ex: 民國 98/11/20

felixhuang 發表在 痞客邦 留言(1) 人氣()

如果XML要儲存在網頁上,有時會因為特殊字元產生錯誤,可以先寫個轉換的 function :

function XMLEncode(str)
{
       str=Trim(str);

       str=str.replace("&","&amp;");

       str=str.replace("<","&lt;");

       str=str.replace(">","&gt;");

       str=str.replace("'","&apos;");

       str=str.replace("\"","&quot;");

       return str;

}

felixhuang 發表在 痞客邦 留言(0) 人氣()

/**************************
 開啟新視窗
***************************/
function openWindows(a_Url){
  var sUrl = a_Url;
  var sTitle = "開新視窗"; // 視窗標題
  var sToolbar = "no"; //
  var sLocation = "no"; //位置列
  var sDirectories = "no"; //目錄
  var sStatus = "no"; // 狀態列
  var sMenubar = "no";
  var sScrollbars = "yes";
  var sResizable = "no";
  var sWidth = "600";
  var sHeight = "550";
  var sParams = "toolbar=" + sToolbar + ",directories=" + sDirectories + ",status=" + sStatus + ",menubar=" + sMenubar + ",scrollbars=" + sScrollbars + ",resizable=" + sResizable + ",width=" + sWidth + ",height=" + sHeight;
  //alert(sParams);
  //
  window.open(sUrl,sTitle,sParams);
 }

felixhuang 發表在 痞客邦 留言(0) 人氣()

符號

表示式

說明或範例

不成立字串

.

a.

表示任何字元。

含字母 "a" 以及其後任一個字元的字串。

Ex: "ab", "bac"

"a", "ba"

重覆字串

*

ab*

表示沒有或更多字元。

"ab*":表示一個字串有一個a後面跟著零個或若干個b

Ex: "a", "ab", "abbb"

 

+

ab+

一次或更多字元。

"ab+":表示一個字串有一個a後面跟著至少一個b或者更多

Ex: “ab”,”abbbb”

 

?

ab?

沒有或一次字元。

ab?":表示一個字串有一個a後面跟著零個或者一個b

Ex: “a”,”ab”

 

[]

[13579]

方括號表示某些字元允許在一個字串中的某一特定位置出現。

包含 "1" "3" "5" "7" "9" 的字串。

Ex: "a3b", "1xy"

"y2k"

 

[0-9]

含數字之字串

不含數字之字串

 

[a-z0-9]

含數字或小寫字母之字串

不含數字及小寫字母之字串

 

[a-zA-Z0-9]

含數字或字母之字串

不含數字及字母之字串

 

b[aeiou]t

"bat", "bet", "bit", "bot", "but"

"bxt", "bzt"

 

^[a-zA-Z]

表示一個以字母開頭的字串

 

 

[0-9]%

表示一個百分號前有一位元的數位

 

 

[a-zA-Z0-9]$

表示一個字串以一個逗號後面跟著一個字母或數位結束

 

{}

ab{2}

用以表示重復次數的範圍。

表示一個字串有一個a跟著2b

Ex: "abb"

 

 

ab{2,}

表示一個字串有一個a跟著至少2b

 

 

ab{3,5}

表示一個字串有一個a跟著35b

 

字串位置

^

^xy

"xy" 開始的字串

Ex: "xyz", "xyab"

"axy", "bxy"

$

xy$

"xy" 結尾的字串

Ex: 例如:"axy", "abxy"

"xya", "xyb"

[^]

[^0-9]

不希望出現的字元,'^'應在方括號裏的第一位。

不含數字之字串

 

含數字之字串

 

%[^a-zA-Z]%

兩個百分號中不應該出現字母

 

 

[^aeiouAEIOU]

不含母音之字串

含母音之字串

 

[^\^]

不含 "^" 之字串,例如:"xyz", "abc"

"xy^", "a^bc"

特殊字元

\d

 

數字0~9

 

\D

 

非數字

 

\w

 

數字、字母、底線

 

\W

 

\w

 

\s

 

空白字元 + \r\t\n\f

 

\S

 

\s

 

|

(b¦cd)ef

表示”或”

"bef""cdef"

 

\

^\^

跳脫字元,將特殊符號的義意去除,^.$()¦*+?{\"這些字元前加上跳脫字元'\'

字首必須是^

 

 

 

 

 

felixhuang 發表在 痞客邦 留言(0) 人氣()