Function.createDelegate(),
Steps create client delegate:
1) create client delegate by using Function.createDelegate(this, functionName)
2) add the new delegate into $addHandler(this, newDelegate)
3) access the window object, write the function
example:
function pageLoad() {
var clickDelegate = Function.createDelegate(this,onButtonClick);
$addHandler($get('btnTest'),'click',clickDelegate);
}
function onButtonClick()
{
alert(String.format("this code is funning on {0} {1}", Sys.Browser.name, Sys.Browser.version));
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment