页面没有重新加载

时间:2015-09-23 11:09:14

标签: javascript android jquery html cordova

我使用过mobile.js.在我的应用程序中使用phonegap开发应用程序

请检查我的代码

的index.html

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>PlayTradeWin</title>
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- Include jQuery Mobile stylesheets -->
        <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">

        <!-- Include the jQuery library -->
        <script src="cordova.js"></script>

        <!-- Include the jQuery library -->
        <script src="js/jquery-1.11.3.min.js"></script>
        <!-- Include the jQuery Mobile library -->
        <script src="js/jquery.mobile-1.4.5.min.js"></script>
        <script type="text/javascript">
          document.addEventListener("deviceready", onDeviceReady, false);
          function onDeviceReady() {
              //some js code here
          }
        </script>
     </head>
<body>
<a href="login.html" data-transition="flip">Login</a>
</body>
</html>

的login.html

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>PlayTradeWin</title>
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- Include jQuery Mobile stylesheets -->
        <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">

        <!-- Include the jQuery library -->
        <script src="js/jquery-1.11.3.min.js"></script>
        <!-- Include the jQuery Mobile library -->
        <script src="js/jquery.mobile-1.4.5.min.js"></script>
         <script>
              alert("Hello");
         </script>
     </head>
<body>
   Login form here..
</body>
</html>

我的网页完美展开但是当我通过点击index.html页面中的index.html链接login.html Login时,我的JavaScript提醒无效。

2 个答案:

答案 0 :(得分:0)

使用

$( function() {
 alert('Hello');
});

答案 1 :(得分:0)

我想Cordova不支持将这种类型的js脚本注入HTML。您需要在index.js脚本中执行逻辑。

此外,如果您希望执行警报,可以使用apache cordova插件进行通知(您可以通过项目配置 - >插件获取它。)

相关问题