[editor: moving to the appropriate forum…]
function maxAge(a,b){
if (a>b){
alert(a);
}else{
alert(b);
}
btn = new my.button({},"button1");
dojo.connect(btn,"onclick",null,"maxAge");
myQuestion is how can i pass arguments to maxAge when i click on button1
what do i need to change or add?

There are many ways to pass
There are many ways to pass arguments to an event handler. You didn't tell how arguments depend on clicking, so it is a pure speculation on my part:
dojo.connect(btn, "onclick", dojo.hitch(null, maxAge, a, b));