Blackberry 上的 WebSql-phonegap
我是黑莓新手。我使用phonegap 来创建跨平台应用程序。我正在使用phonegap 在黑莓上尝试websql。我的 html 文件如下所示:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" charset="utf-8">
var db= openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
var msg;
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS COMPANY (id unique, log)');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (1, "Unisys")');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (2, "UGSI")');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (3, "TCIS")');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (4, "mobcomp")');
msg = '<p>Log message created and row inserted.</p>';
document.querySelector('#status').innerHTML = msg;
});
db.transaction(function (tx) {
tx.executeSql('SELECT * FROM COMPANY', [], function (tx, results) {
var len = results.rows.length, i;
msg = "<p>Found rows: " + len + "</p>";
document.querySelector('#status').innerHTML += msg;
for (i = 0; i < len; i++){
msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
document.querySelector('#status').innerHTML += msg;
}
}, null);
});
</script>
</head>
<body>
<div id="status" name="status">Status Message</div>
</body>
</html>
此代码在 ANDROID 上运行良好。但在黑莓上,模拟器除了状态消息行外不显示任何内容。 有人可以帮我解决这个问题吗?
提前致谢, 阿克沙塔
I'm new to Blackberry. I use phonegap to create cross platform applications. I'm trying websql on blackberry using phonegap. My html file looks like this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" charset="utf-8">
var db= openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
var msg;
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS COMPANY (id unique, log)');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (1, "Unisys")');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (2, "UGSI")');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (3, "TCIS")');
tx.executeSql('INSERT INTO COMPANY (id, log) VALUES (4, "mobcomp")');
msg = '<p>Log message created and row inserted.</p>';
document.querySelector('#status').innerHTML = msg;
});
db.transaction(function (tx) {
tx.executeSql('SELECT * FROM COMPANY', [], function (tx, results) {
var len = results.rows.length, i;
msg = "<p>Found rows: " + len + "</p>";
document.querySelector('#status').innerHTML += msg;
for (i = 0; i < len; i++){
msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
document.querySelector('#status').innerHTML += msg;
}
}, null);
});
</script>
</head>
<body>
<div id="status" name="status">Status Message</div>
</body>
</html>
This code is working fine with ANDROID. But on Blackberry the simulator is not displaying anything except the status message line.
Can anyone please help me on this issue?
Thanks in advance,
Akshatha
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Blackberry 5.0 不支持 HTML5 WebSQL,而是使用 Google Gears API
http://code.google.com/intl/es-ES /apis/gears/api_database.html
Blackberry 5.0 don't support HTML5 WebSQL, instead uses Google Gears API
http://code.google.com/intl/es-ES/apis/gears/api_database.html