2009-09-17 97 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); 
}