我正在为 android 设备创建一个基本应用程序。我正在使用普通的 Jade、JavaScript 和 PouchDB 数据库。当我在模拟器、HTC、平板电脑等安卓设备上部署应用程序时,它运行良好,但对于三星设备(Android v. 4.1.3、4.2.2)则无法运行。
我的翡翠代码是
head
script(src='../javascripts/pouchdb-nightly.min.js').
script(type="text/javascript").
var db = new PouchDB('pouchexample');
function addBook(){
var booktitle= window.document.bookform.titlefield.value;
var authorfield= window.document.bookform.authorfield.value;
var isbnfield= window.document.bookform.isbnfield.value;
var book = {
_id : isbnfield,
title : booktitle,
author : authorfield
};
db.put(book,function(err,res){
if(!err){
clearField();
document.getElementById("message").innerHTML =
"new boook added";
}
});
}
function clearField() {
window.document.bookform.titlefield.value="";
window.document.bookform.authorfield.value="";
window.document.bookform.isbnfield.value="";
}
function showBooks(){
db.allDocs({include_docs:true, descending:true}, function(err, doc){
showTableOfBooks(doc.rows);
});
}
function showTableOfBooks(data){
var div = document.getElementById("message");
var str = "<table border='1' align='left'><tr><th>isbn</th><th>title</th><th>author</th></tr>";
for(var i=0; i<data.length;i++){
str +="<tr><td>"+data[i].doc._id+"</td><td>"+data[i].doc.title+"</td><td>"+data[i].doc.author+"</td></tr>"
}
str+="</table> ";
div.innerHTML = str;
}
body
form(name='bookform')
| book title
input(type='text', name='titlefield')
br
| book author
input(type='text', name='authorfield')
br
| book isbn
input(type='text', name='isbnfield')
br
input(type='button', value='add book', onclick='addBook()')
br
input(type='button', value='clear fields', onclick='clearFields()')
br
input(type='button', value='show book', onclick='showBooks()')
#message
我从http://download.pouchdb.com/pouchdb-nightly.min.js下载了“pouchdb-nightly.min.js”
请告诉我此问题的适当解决方案。
谢谢...