Monday, November 2, 2009

JavaScript iPhone Web App

We wrote our first iPhone web app in class on Thursday. It was a simple app that utilized JavaScript to register which way the iPhone was oriented. We the iPhone was turned to the right or the left the accelerometer registered the change and the text on the page was updated to show which way the screen was oriented.

I added a few lines of JavaScript to have the screen display when ever the page is first loaded. That way the user doesn't have to turn the phone to get the orientation to register.

Here is the JavaScript code to make it work:

No comments:

Post a Comment