我正在尝试在jquery移动页面中动态自动地在页面加载时创建并打开一个对话框但是我无法做到这一点。我想我错过了一些但却无法得到的东西.. 这是我的jquery代码和函数,在pageload上调用..
function onLoad() {
openDialogBox1();
document.addEventListener("deviceready", onDeviceReady, false);
$("#searchby_chooser_ok_button").bind ("click", searchByCriteria);
if (typeof Contact === "undefined") {
getElement("contacts_list").innerHTML = "<p>The Cordova Contacts API is inaccessible</p>";
}
}
function openDialogBox1(){
$("#simplestring").simpledialog({
'mode' : 'string',
'prompt' : 'Please Enter Your Mobile No.',
'buttons' : {
'OK': {
click: function () {
$('#dialogoutput').text($('#dialoglink').attr('data-string'));
}
},
'Cancel': {
click: function () { },
icon: "delete",
theme: "c"
}
}
})
}
请帮我纠正错误..谢谢..
答案 0 :(得分:0)
尝试更改此行:
document.addEventListener("deviceready", onDeviceReady, false);
由此:
document.addEventListener("deviceready", openDialogBox1, false);
答案 1 :(得分:0)
由于你使用的是jquery,你可以试试这个:
$(document).ready(function(){
openDialogBox1();
document.addEventListener("deviceready", onDeviceReady, false);
$("#searchby_chooser_ok_button").bind ("click", searchByCriteria);
if (typeof Contact === "undefined") {
getElement("contacts_list").innerHTML = "<p>The Cordova Contacts API is inaccessible</p>";
}
}
function openDialogBox1(){
$("#simplestring").simpledialog({
'mode' : 'string',
'prompt' : 'Please Enter Your Mobile No.',
'buttons' : {
'OK': {
click: function () {
$('#dialogoutput').text($('#dialoglink').attr('data-string'));
}
},
'Cancel': {
click: function () { },
icon: "delete",
theme: "c"
}
}
})
});