Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7986377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:50:21+00:00 2026-06-04T11:50:21+00:00

I included a page in my program that displays the accelerator data from the

  • 0

I included a page in my program that displays the accelerator data from the mobile device using PhoneGap Cordova. I’m also using JQuery. My problem is that it’s not displaying the data. What am I doing wrong? I’m very new to mobile HTML and JavaScript development.

     <!DOCTYPE html> 
    <html>
    <head>
    <meta charset="UTF-8">
    <title>jQuery Mobile Web App</title>
    <link href="jquery-mobile/jquery.mobile.theme-1.0.min.css" rel="stylesheet" type="text/css"/>
    <link href="jquery-mobile/jquery.mobile.structure-1.0.min.css" rel="stylesheet" type="text/css"/>
    <script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
    <script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
    </head> 
    <body> 

    <div data-role="page" id="page">
        <div data-role="header">
            <h1>Page One</h1>
        </div>
        <div data-role="content">   
            <ul data-role="listview">
                <li><a href="#page2">Page Two</a></li>
                <li><a href="#page3">Page Three</a></li>
                <li><a href="#page4">Page Four</a></li>
                <li><a href="#page6">Accelerator Example</a></li>
                <li><a href="#page5">Alert Example</a></li>
            </ul>       
        </div>
        <div data-role="footer">
            <h4>Page Footer</h4>
        </div>
    </div>

     //code from other pages excluded

    <div data-role="page" id="page6">
    <div data-role="header">
        <h1>Accelerator example 2</h1>
    </div>
    <div data-role="content" data-theme="b">
    <script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
    <script type="text/javascript" charset="utf-8">
    document.getElementById("ready").innerHTML = "false";
    // Wait for Cordova to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is ready
    //
    function onDeviceReady() {
        document.getElementById("ready").innerHTML = "true";
        navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
    }

    // onSuccess: Get a snapshot of the current acceleration
    //
    function onSuccess(acceleration) {
        /*alert('Acceleration X: ' + acceleration.x + '\n' +
              'Acceleration Y: ' + acceleration.y + '\n' +
              'Acceleration Z: ' + acceleration.z + '\n' +
              'Timestamp: '      + acceleration.timestamp + '\n');
              document.writeln(
              'Acceleration X: ' + acceleration.x + '\n' +
              'Acceleration Y: ' + acceleration.y + '\n' +
              'Acceleration Z: ' + acceleration.z + '\n' +
              'Timestamp: '      + acceleration.timestamp + '\n');*/
             /* $("ax").html(acceleration.x);
    $("ay").html(acceleration.y);
    $("az").html(acceleration.z);
    */
    document.getElementById("ax").innerHTML = acceleration.x;
    document.getElementById("ay").innerHTML = acceleration.y;
    document.getElementById("az").innerHTML = acceleration.z;
    }

    // onError: Failed to get the acceleration
    //
    function onError() {
        alert('onError!');
    }


    </script>
  </head>
  <body>
    <h1>Example</h1>
    <p>getCurrentAcceleration</p>
    <p id="ax"></p>
    <p id="ay"></p>
    <p id="az"></p>
    <p id="ready"></p>
    </div>
    <div data-role="footer">
        <h4>Page Footer</h4>
    </div>
</div>



</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:50:22+00:00Added an answer on June 4, 2026 at 11:50 am

    Your example has two body tags and the content from the second body is not shown.

    A working example of the accelerometer with jQuery Mobile and PhoneGap is available here.

    If you’re targeting Android the project creation wizard in AppLaud Eclipse plugin or AppLaud Cloud will provision a fully running project for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I included a repeater in my master page. The repeater has a button that
Using the example code included in the man page for DateTime::Astro::Sunrise , I'm getting
I have a fancy web page with lots on JQuery included. Currently i am
I have a pretty large site and every page is built from several included
My PHP site has header,body,footer files that are included into the INDEX.PHP page. On
I've got a program that add's a bunch of Div's to a page. I
I am using an extension that depends on the page. I would like to
I would like to create an order form for my ASP.net page (I included
In my view, I have included the Master page as follows: <%@ Page Title=
In my xhtml page I have the following tag included: <f:view locale=#{languageBean.locale}> ... </f:view>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.