2009-09-17 113 views
0

我已經看到了在asp.net AJAX客戶端腳本的不少例子如下:ASP.Net Ajax客戶端腳本,訪問源

function fHelloWorld(source, eventArgs) 
{ 

} 

如果我運行它返回的源警報作爲一個對象。我可以用它來訪問所謂的函數嗎?如果是的話如何?我已經嘗試過的東西像

source.id; 

沒有運氣

回答

1

,我可以提供,給定一個對象,枚舉的屬性和它們寫出來,包括它們的值到頁面的最好的建議。然後檢查房產價值,並肯定會發現這種房產是否存在。您也可以使用Firebug,Fiddler2或其他工具的主機來檢查對象。

下面是一個例子

function pageLoad(sender, args) { 

// add function to the PageRequestManager to be executed on async postback initialize 
var prm = Sys.WebForms.PageRequestManager.getInstance(); 
     prm.add_initializeRequest(InitializeRequest); 
} 


function InitializeRequest(sender, args) { 
    // Display loader gif when async postback initialized by element_in_question 
    if(args._postBackElement.id === 'id_of_element_in_question' {    
     $get('ajax-loader').style.display = 'inline'; 
    }   
} 
0

運行與Firefox &螢火蟲,set a breakpoint你的函數裏面的頁面,並以交互檢查source對象。

您也可以顯示與console.log對象獲取對象的檢查超鏈接:

function fHelloWorld(source, eventArgs) 
{ 
    console.log("%o", source); 
}