【发布时间】:2015-04-21 05:52:01
【问题描述】:
function listContents(storagename) {
alert("inside function");
//Clear up the list first
$('#results').html("");
var files = navigator.getDeviceStorage(storagename);
var cursor = files.enumerate();
cursor.onsuccess = function () {
//alert("Got something");
var file = this.result;
if (file != null) {
var imageElement = $('<img height="100" width="75">');
imageElement.attr('src', window.URL.createObjectURL(file));
var tagvalue= $("<p>" + file.name + "," + file.lastModifiedDate + "," + file.type + "," + file.size + "</p>").appendTo('#results');
imageElement.appendTo("#results");
this.done = false;
}
else {
this.done = true;
}
if (!this.done) {
this.continue();
}
}
}
imageElement.onclick = function() {
console.log('onclick function!');
//alert('blah');
}
我正在从 Firefox OS 的 SDCard 中检索音频文件列表。现在我想将此文件上传到服务器,因此当我在图像元素上执行 onclick 时,我可以执行任何事件,因此我试图显示警报框,但它不起作用。
【问题讨论】:
标签: javascript jquery firefox-os