Upon clicking button for custom function page gets printed

I facing an awkward behavior of Button click.
Whenever i click on button which linked with a function , Page gets Printed.
I had to cancel it every time to get proceed further.