$(document).ready(function () {
//原先的寫法:
$("td").bind("click", function(){
$(this).toggleClass("click");
});
//事件委託:
$("table").delegate("td","click", function(){
$(this).toggleClass("click");
});
})
Public Sub AddNewCustomer(customer As Customer, Optional dateAdded As Date = Nothing)
If dateAdded = Nothing Then dateAdded = Now
// C# 4.0 以後的 function 已經可以使用 optional 參數
public void AddNewCustomer(Customer customer, DateTime dateAdded = default(DateTime))
{
if (dateAdded == default(DateTime)) dateAdded = DateTime.Now;
......
Public Sub AddNewCustomer(customer As Customer, Optional dateAdded As Date = #12/30/1899#)
Common.popUp2({Title:'Title1',OKText:'OKText2'})
List<DB.Member> listOfMember = new List<DB.Member>()
{ new DB.Member(15), new DB.Member(20), new DB.Member(25), new DB.Member(30) };
// Exists: 單純看有無符合條件的資料
bool IsMemberExists = listOfMember.Exists(x => x.Email == "darren@acaciaco.com");
// FindIndex: 找出第一個符合條件的 index,找不到傳回 -1
int index = listOfMember.FindIndex(x => x.Email == "darren@acaciaco.com");
// Find: return 第一個符合條件的object, 找不到傳回 null
DB.Member objMember = listOfMember.Find(x => x.Email.Contains("acaciaco.com"));
// FindAll: return 所有符合條件的objects
List<DB.Member> listOfMember2 = listOfMember.FindAll(x => x.Email.Contains("acaciaco.com"));
Dim listOfMember As New List(Of DB.Member)() From { _
New DB.Member(15), New DB.Member(20), New DB.Member(25), New DB.Member(30) }
' Exists: 單純看有無符合條件的資料
Dim IsMemberExists As Boolean = listOfMember.Exists(Function(x) x.Email = "darren@acaciaco.com")
' FindIndex: 找出第一個符合條件的 index,找不到傳回 -1
Dim index As Integer = listOfMember.FindIndex(Function(x) x.Email = "darren@acaciaco.com")
' Find: return 第一個符合條件的object, 找不到傳回 Nothing
Dim objMember As DB.Member = listOfMember.Find(Function(x) x.Email.Contains("acaciaco.com"))
' FindAll: return 所有符合條件的objects
Dim listOfMember2 As List(Of DB.Member) = listOfMember.FindAll(Function(x) x.Email.Contains("acaciaco.com"))
前台要引用
<!--AutoScripts S-->PageShift2<!--AutoScripts E-->
<!--AutoCSS S-->2013UI/PageShift<!--AutoCSS E-->
內文架構要有
<div id="PageShift2" class="page-index"></div>
<script>
$('#PageShift2').PageShift2({
PageIndex: 1,
PageMAX: 10,
TriggerEvent: ChangePage
});
function ChangePage(PageIndex) {
console.log(PageIndex);
}
</script>