【发布时间】:2015-09-23 19:21:22
【问题描述】:
我使用过 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 页面中的 Login 链接将 index.html 转到 login.html 时,我的 JavaScript 警报不起作用。
【问题讨论】:
-
您使用的是jquery mobile,当您使用jquery mobile时,您不会加载整个login.html页面,只需获取html内容,如果您想在login.html页面加载时执行代码,有相应的事件
-
是的,我正在使用该事件。那也行不通。
-
然后,显示你的代码
-
@jcesarmobile 告诉我如何使用移动事件加载?
标签: javascript android jquery html cordova