我想檢查一個特定的按鈕被點擊時的情況如何做到這一點?如何獲得點擊哪個按鈕?
$(document).ready(function() {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
Search("Other");
});
function InitializeRequest(sender, args) {
}
function EndRequest(sender, args) {
alert(sender._postBackSettings.sourceElement.id)
var str1 = new String(sender._postBackSettings.sourceElement.id);
if (sender._postBackSettings.sourceElement.id == ContentPlaceHolder1_btnNew) {
alert("You have clicked new")
Search("NEW");
}
else {
alert("OTHERS")
Search("Other");
}
}
這正是我正在尋找的 - 謝謝! – Jeff