phonegap写安卓程序问题
代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact Example</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
document.write("等待加载PhoneGap");
document.addEventListener("deviceready", onDeviceReady, false);
document.write("PhoneGap加载完毕");
function onDeviceReady() {
alert("begin");
var myContact = navigator.service.contacts.create({"displayName": "Test User"});
myContact.gender = "male";
document.write("The contact, " + myContact.displayName + ", is of the " + myContact.gender + " gender");
alert("end");
}
</script>
</head>
<body>
<h1>Example</h1>
<p>Create Contact</p>
</body>
</html>
在eclipse的安卓模拟器上运行结果为:
等待加载PhoneGapPhoneGap加载完毕
Example
Create Contact
alert不见了。。貌似并没有进入到那个函数里面去.....唉 求各位高人指点