我的Cordova应用程序适用于此链接http://autoskole.rs.sr/cordova/www/kategor.html,但是当我在android上构建它时,似乎它不会执行JavaScript代码。
任何想法为什么不起作用? 这是文件kategor.html
的代码
<html>
<head>
<frame src="frame_a.htm" scrolling="yes">
<script type="text/javascript" src="js/kategor.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="css/tacniodg.css" rel="stylesheet">
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<script src="scripts/platformOverrides.js"></script>
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic/js/angular/angular-mocks.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/kategor.js"></script>
<script src="lib/fastclick.js"></script>
<script src="lib/jquery.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body ng-app="starter" style="margin-bottom: 98px;5" onload="function()">
<ion-pane>
<ion-header-bar class="bar-positive">
<button class="button button-icon icon ion-navicon" onclick="location.href='main.html';"></button>
<h1 class="title icon-left ion-model-s" ><font size="5" face="Arial" > Auto škola "Volan" </font></h1>
</ion-header-bar>
<ion-content>
</br>
<div id="container">
</div>
<div data-role='page'>
<script>
$(document).ready(function () {
//uzima spisak autoskola..
$("#container").html('');
var autoschools = [];
var categories = [];
var tests = [];
$.ajax( "http://autoskole.rs.sr/api/autoschools" )
.done(function(data) {
console.log(data);
for(index in data) {
var row = data[ index ];
autoschools[ row.id ] = row;
$("#container").append('<p><button style="background: #4b7a99; background: -webkit-gradient(linear, left top, left bottom, from(#6faed9), to(#4b7a99)); background: -webkit-linear-gradient(top, #6faed9, #4b7a99); padding: 13px 26px; -webkit-border-radius: 14px; -moz-border-radius: 14px; border-radius: 14px; -webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0; text-shadow: #7ea4bd 0 1px 0; color: #ffffff; font-size: 18px; font-family: helvetica, serif; " class="autoschools" id="'+ row.id +'" href="#">Pokreni Test</button></p>');
}
$(".autoschools").on('click', function (e) {
e.preventDefault();
var schoolId = $(this).prop('id');
$.ajax( "http://autoskole.rs.sr/api/autoschool/" + schoolId )
.done(function(data) {
$("#container").html('');
$("#container").append('<h2>'+ autoschools[ schoolId ].name +'</h2>');
$("#container").append('<h3>Kategorije</h3>');
if(undefined != data.categories && data.categories.length > 0) {
for(index in data.categories) {
var row = data.categories[ index ];
categories[ row.id ] = row;
$("#container").append('<p><button style="background: #4b7a99; background: -webkit-gradient(linear, left top, left bottom, from(#6faed9), to(#4b7a99)); background: -webkit-linear-gradient(top, #6faed9, #4b7a99); padding: 13px 26px; -webkit-border-radius: 14px; -moz-border-radius: 14px; border-radius: 14px; -webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0; text-shadow: #7ea4bd 0 1px 0; color: #ffffff; font-size: 18px; font-family: helvetica, serif; " class="categories" id="'+ row.id +'" href="#">'+ row.name +'</button></p>');
if(undefined != row.tests && row.tests.length > 0) {
for(var i in row.tests) {
var rowt = row.tests[ i ];
if(tests[ row.id ] == undefined) {
tests[ row.id ] = [];
}
tests[ row.id ].push(rowt);
}
}
}
console.log(tests);
$(".categories").on('click', function (e) {
e.preventDefault();
var catId = $(this).prop('id');
$("#container").html('');
$("#container").append('<h2>'+ autoschools[ schoolId ].name +'</h2>');
$("#container").append('<h3>Kategorija - '+ categories[ catId ].name +'</h3>');
for(index in tests[ catId ]) {
var row = tests[ catId ][ index ];
$("#container").append('<a href="pitanjanew.html"><p><button style="background: #4b7a99; background: -webkit-gradient(linear, left top, left bottom, from(#6faed9), to(#4b7a99)); background: -webkit-linear-gradient(top, #6faed9, #4b7a99); padding: 13px 26px; -webkit-border-radius: 14px; -moz-border-radius: 14px; border-radius: 14px; -webkit-box-shadow: rgba(255,255,255,0.4) 0 1px 0, inset rgba(255,255,255,0.4) 0 1px 0; text-shadow: #7ea4bd 0 1px 0; color: #ffffff; font-size: 18px; font-family: helvetica, serif; " class="tests" id="'+ row.id +' href="pitanja.html">'+ row.name +'</button></p></a>');
}
});
function redirect()
{
var url = "pitanjanew.html";
window.location(url);
}
}
});
return false;
});
})
.fail(function() {
alert( "error" );
});
//uzima spisak korisnika
$("#load-users").on('click', function (e) {
e.preventDefault();
$("#user-container").html('');
$.ajax( "http://autoskole.rs.sr/api/test-users" )
.done(function(data) {
console.log(data);
for(index in data) {
var row = data[ index ];
$("#user-container").append('<p>'+ row.name +'</p>');
}
})
.fail(function() {
alert( "error" );
});
return false;
});
});
</script>
</div>
</ion-content>
</ion-pane>
</body>
</html>
&#13;