現在のボタンのidを取得するには、this.idで行います。


 
function getid(id) {
alert(id);
}
<input id="btn1" type="button" value="test" onclick="return getid(this.id)" />