need help with script

hi

i am trying to rotate my object when ever button pressed but its not working. With out button its working. my aim is when i am button pressed then the rotation script activated automatically. But is failed please help me.

i am send my code below

function OnGUI()

 {

 if(GUI.Button(Rect(0,0,50,30),"rotate"))

 {

   rotationX = Input.GetAxis("Mouse X") * sensitivityX;

   rotationY = Input.GetAxis("Mouse Y") * sensitivityY;

   transform.RotateAroundLocal( cameraTm.up, -Mathf.Deg2Rad * rotationX );

   transform.RotateAroundLocal( cameraTm.right, Mathf.Deg2Rad * rotationY );

 }
}

Best to use Input functions in Update. So set a boolean in OnGUI that the thing has happened and test for it in Update to do your rotates.