【发布时间】:2015-11-13 12:39:06
【问题描述】:
我对 Phone Gap 还很陌生。我对 HTML 和 jQuery 有一个清晰的了解。在 HTML 中看似非常简单的东西,在 Phone Gap 中使用时却变得不那么简单了。
目前我正在 Android 设备上对其进行测试。
我正在尝试显示图像,正在从服务器中提取图像。
输出 HTML
<h3>The Bass Angler</h3>
<table>
<tr>
<td><strong>Price: </strong>R35</td>
</tr>
<tr>
<td>
<img style="width: 50%; height: 50%" src="http://www.adventurebuddy.co.za/uploads/cover.PNG" />
</td>
</tr>
</table>
jQuery
function ViewMag(id)
{
db.transaction(function(tx) {
tx.executeSql("select magid,name,price from mag where magid = " + id + " order by name", [],
function(tx, rs){
html = '<br /><h3>' + rs.rows.item(0).name + '</h3>';
html += '<table><tr><td><strong>Price: </strong>R' + rs.rows.item(0).price + '</td></tr>'
// Load editions for a magazine
db.transaction(function(tx1){
tx1.executeSql("select editionid,editiondate,filepath,cover from editions where deleted is null and magid = " + id, [],
function(tx1,rs1){
if(rs1.rows.length == 0)
html += '<p>No editions found.</p>';
else
{
//html += '<ul class="">';
for(ri1=0;ri1<rs1.rows.length;ri1++)
{
var coverurl = APPSERVER + '/uploads/' + rs1.rows.item(ri1).cover;
var file = APPSERVER + '/uploads/' + rs1.rows.item(ri1).filepath
html += '<tr><td><img style="width: 50%; height: 50%" src="' + coverurl + '" /></td></tr>'
}
html += '</table>';
}
});
});
$.ui.updatePanel('#main',html);
$.ui.setTitle(rs.rows.item(0).name);
$.ui.loadContent('#main',false,false,"right");
},
window.onDBError
);
});
如果我将 HTML 代码保存为 htm 文件,它可以正常工作,但不能在手机上工作。我错过了什么?
在此先感谢
【问题讨论】:
-
您的问题解决了吗?
标签: android jquery html cordova phonegap-plugins