我正在使用插件jquery.mobile.paramsHandler从我的Phonegap应用程序的页面获取参数但是当我将插件的jQuery代码添加到我的html页面时,我在我的javascript部分中定义的所有其他函数页面不起作用,但是当我删除插件使用时,功能完美,请帮忙。这是我的代码的一部分
<script type="text/javascript">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
// Now safe to use the Cordova API
checkInternerAccess();
checkLocationService();
getPosition();
}
// alternative to DOMContentLoaded
document.onreadystatechange = function () {
if (document.readyState === "complete") {
getPerviousAddress();
}
};
//Using param handler jQuery to get parameters of the URL
function getPreviousAddress(){
$(function () {
$.mobile.paramsHandler.addPage(
"images-upload", // jquery mobile page id which will accept parameters
["param1"], // required parameters for that page
[], // optional parameters for that page,
function (urlVars) {
var selectedOrgan = document.getElementById('selectedOrganization');
selectedOrgan.value = urlVars.param1;
}
);
$.mobile.paramsHandler.init();
});
}
//These functions do not work
function myFunction() {
document.getElementById("demo").innerHTML = "YOU CLICKED ME!";
}
function takePhoto() {
navigator.camera.getPicture(onCameraSuccess, onCameraError);
}
function onCameraSuccess(imageURL) {
navigator.notification.alert("onCameraSuccess: " + imageURL);
}
</script>
<script src="js/jquery.mobile-1.4.5.min.js" type="text/javascript"></script>
</head>
<body onload="onBodyLoad()">
<div data-role="page" id="camera_report">
<div data-role="content">
<div data-role="controlgroup">
<p style="font-size:12px; font-weight:bold; padding-bottom:20px">Please Select One Option</p>
<a href="#images-upload?param1=Tanesco" data-role="button">
<img style="float:left" src="imgs/1. TANESCO.jpg" />TANESCO
</a>
<a href="#images-upload?param1=Dawasco" data-role="button">
<img style="float:left" src="imgs/2. DAWASCO.jpg" />DAWASCO
</a>
</div>
</div>
</div>
<div data-role="page" id="images-upload">
<div class="home-content" data-role="content">
<div data-role="controlgroup">
<div class="images-display">
<form role="form">
<div style="">
<div class="form-group">
<input type="text" class="form-control" id="damage" placeholder="Maelezo Kuhusu Uharibifu" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Andika Maelezo Mafupi'">
<input type="text" id="longitude" value="" name="current-longitude">
<input type="text" id="latitude" value="" name="current-latitude">
<input type="text" id="selectedOrganization" name="param1display">
</div>
</div>
</form>
</div>
</div>
</div>
<div>
</body>