Alert before close grdi

Hi, simple question (i’ve searched but i didn’t find solution). how can i put an alert message in a GRID application before close ? .I’ve tried sc_exit(sel) whit a php button but it open another window… It is non a solution form my as i’ve to return to the previus application caller