This page demonstrates how to use the device motion JavaScript object to read physical X, Y, Z acceleration values of the current device.
Live demo: http://www.mobilexweb.com/samples/ball.html