我使用vs2012,我开发一个PhoneGap的应用程序,该应用程序中,我使用下面的JavaScript代码:PhoneGap的应用 - “deviceready”事件侦听器不会被调用
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady()
{
// alert("hh");
console.log("Entering index.html.onDeviceReady");
//var element = document.getElementById('deviceProperties');
var html = "";
html = html + "<li>" + 'Device Name: ' + device.name + "</li>";
html = html + "<li>" + 'Device Cordova: ' + device.cordova + "</li>";
html = html + "<li>" + 'Device Platform: ' + device.platform + "</li>";
html = html + "<li>" + 'Device UUID: ' + device.uuid + "</li>";
console.log(html);
$("#deviceProperties").html(html);
$("#deviceProperties").listview('refresh');
console.log("Exiting index.html.onDeviceReady");
}
但功能不调用并不会动态添加任何元素。我究竟做错了什么?
但是该函数没有被调用,也没有动态添加任何元素。我究竟做错了什么? – sekhar18290 2013-05-09 10:49:50
将addEventListener中的第三个参数更改为“true”。 – dejavu 2013-05-10 06:29:19