2017-01-30 5 views
-1

私はApacheのコードコーディングとjQueryを使用して簡単なアプリケーションを作成しようとしています。私の問題は次のようなものです。ブラウザ上で(コンピュータ上で)page.htmlを開くと、それは偶然に働きます。私が.apkを作るとき、それは動かない。jQueryがApacheのコードバで動作していない

私のコードはこれです:

<!DOCTYPE html> 
<!-- 
    Licensed to the Apache Software Foundation (ASF) under one 
    or more contributor license agreements. See the NOTICE file 
    distributed with this work for additional information 
    regarding copyright ownership. The ASF licenses this file 
    to you under the Apache License, Version 2.0 (the 
    "License"); you may not use this file except in compliance 
    with the License. You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, 
    software distributed under the License is distributed on an 
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
    KIND, either express or implied. See the License for the 
    specific language governing permissions and limitations 
    under the License. 

    270258529759-mhdktnmarr8givv93t3druvmtc4onkei.apps.googleusercontent.com 
    kZMIedwLUinqBjF2oVFuIjaD 

--> 
<html> 
    <head> 
     <!-- 
     Customize this policy to fit your own app's needs. For more guidance, see: 
      https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy 
     Some notes: 
      * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication 
      * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly 
      * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this: 
       * Enable inline JS: add 'unsafe-inline' to default-src 
     --> 



     <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;"> 
     <meta name="format-detection" content="telephone=no"> 
     <meta name="msapplication-tap-highlight" content="no"> 
     <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> 
     <meta name="google-signin-client_id" content="270258529759-mhdktnmarr8givv93t3druvmtc4onkei.apps.googleusercontent.com"> 
     <link rel="stylesheet" type="text/css" href="css/index.css"> 
     <title>Hello World</title> 

     <link rel="stylesheet" href="jquery.css"> 

     <script src="jquery.js"></script> 
     <script src="defaul.js"></script> 
     <script src="mobileJquery.js"></script> 
     <script type="text/javascript" src="cordova.js"></script> 
     <script type="text/javascript" src="js/index.js"></script> 

    </head> 
    <body> 

      <div data-role="page" id="pageone"> 

    <div data-role="panel" data-position="left" data-display="overlay" id="rightMenu"> 
     <h1>Navigation</h1> 
     <hr /> 
     <a href="#" class="ui-btn ui-icon-arrow-r ui-btn-icon-right">Home Page</a> 
     <a href="page2.html" class="ui-btn ui-icon-arrow-r ui-btn-icon-right">Scan a Barcode</a> 
     <a href="favorites.html" class="ui-btn ui-icon-arrow-r ui-btn-icon-right">Favorites List</a> 
     <a href="pow.html" class="ui-btn ui-icon-arrow-r ui-btn-icon-right">P.O.W.</a> 
     <a href="contact.html" class="ui-btn ui-icon-arrow-r ui-btn-icon-right">Contact Us</a> 
    </div><!-- /panel --> 

    <div data-role="header"> 
     <a href="#rightMenu" id="mypanel" class="ui-btn ui-icon-bars ui-btn-icon-right">Menu</a> <h1>Header Text</h1> 
    </div> 


    <center><img src="img/loading.gif" id="loading"/></center> 

    <div data-role="main" class="ui-content" id="content"> 

      <center><div id="inText">Πριν μποριτε να χρεισιμοποιητε αυτη την εφαρμογη, παρακαλω εγγραφειτε, η αν ειστε ηδη μελος, εισαγετε τον κωδικο σας.</div></center> 

      <div id="rForm"> 
      <br /> 
      <br /> 
      <center>Παρακαλω εισαγγετε την ηλεκτρονικη σας διευθηνση και εναν κωδικο.</center> 
      <br /> 
      <input type="text" id="email" label="email" placeholder="[email protected]" /> 
      <input type="password" id="password" placeholder="password" /> 
      <center><button id="submit">Εγγραφη</button> 
      </div> 

      <div id="loForm"> 
      <br /> 
      <br /> 
      <center>Για να συνδεεστε, παρακαλω εισαγγετε τον κωδικο προσβασης σας</center> 
      <br /> 
      <input type="text" id="emailLo" placeholder="[email protected]" /> 
      <center><button id="loginAl">Συνδεση</button></center> 
      </div> 

      <button class="ui-button ui-widget ui-corner-all" id="register">Εγγραφη</button> 

      <button class="ui-button ui-widget ui-corner-all" id="login">Εισαγωγη κώδικας</button> 

    </div> 

    <div data-role="footer" data-position="fixed"> 
     <h1>Footer Text</h1> 
    </div> 
    </div> 


    </body> 
</html> 

と私のdefaul.js:

$('#content').hide(); 

$(document).ready(function(){ 

    $('#rForm').hide(); 
    $('#loForm').hide(); 
    $('#loading').hide(); 
    $('#content').show(); 

$(document).bind("deviceready", function(){ 

//trigger when click on register button 
    $('#register').click(function(){ 

     $(this).hide(); 
     $('#login').hide(); 
     $('#inText').hide(); 
     $('#rForm').show(function(){ 

     }); 
    }); 

//trigger when click on login button 
    $('#login').click(function(){ 

     $(this).hide(); 
     $('#register').hide(); 
     $('#inText').hide(); 
     $('#loForm').show(function(){ 



     }); 

    }); 

//end of document ready 
}); 
}); 

jQueryのモバイルデザインがうまく働いているが、jQueryの機能が動作していません。

編集:@Nanneエラーはありません。しかし、私のデバイス上でそれを開くと、#rFormと#loFormのどちらも隠さない。そして、イベントが

+2

「deviceready」イベントの外に置いてください史上最高のエラー記述ではありません「機能に動作していません」 :)実際に何が起こるかを含めることができます。あなたはエラーが発生しましたか?そうであれば、console.logsなどを追加してみましたか?(これはあなたの質問に追加してコメントしないでください。また、可能な限り少ないコードで問題を示すサンプルを作成してみてください。余分なコードには含まれていません。 ! – Nanne

答えて

0

を動作しませんあなたのクリックイベントが

が、それはあなたのために仕事のご希望:)

関連する問題