-1
我有在通过点击另一个里所存在另一页上除去锂的问题点击另一个立..和除去锂的id除去锂存在于localStorage的可变..通过使用jquery和JavaScript
这里有两个div出现在同一页面上。 第一李代码是
<div data-role="page" id="wishListPage" data-add-back-btn="true">
<div data-role="header" data-position="fixed">
<header id="mainHeader" align="center">
<a href="#"><img src="images/logoName.png" /> </a>
</header>
</div>
<div data-role="content" data-theme="a" id="wishProducts">
<ul id="wishList" data-role="listview"></ul>
</div>
</div>
立设置,其值是从DATABSE rs.rows.item(i).id
$("#wishList").append('<li id="'+rs.rows.item(i).id+'"><a href="index.html#removeProductDialogPage" data-role="button" data-rel="dialog" data-transition="slide" data-ajax="false" onClick=saveValuesInLocalStorage("'+rs.rows.item(i).id+'","'+rs.rows.item(i).productName+'","'+rs.rows.item(i).imageName+'","'+rs.rows.item(i).vendorImageName+'","'+rs.rows.item(i).fixedPrice+'","'+rs.rows.item(i).finalPrice+'","'+rs.rows.item(i).authorName+'","'+rs.rows.item(i).sharingUrl+'");>' +
'<img src='+rs.rows.item(i).imageName+' id="itemImage"/>'+
'<span id="dataName"><h4>'+pName+'</h4></span>' +
'<p><span id="dataAuthorName">'+aName+'</span></p>' +
'<p><span id="itemRsPrice">Rs. </span><span id="itemStrikePrice"><strike>'+rs.rows.item(i).fixedPrice+'</strike></span> <span id="itemPrice">'+rs.rows.item(i).finalPrice+'</p></span>'+'<img src='+rs.rows.item(i).vendorImageName+' id="itemSite"/></a></li>');
}
$("#wishList").listview("refresh");
这里未来的心愿是UL的id .. ,并存储在localStorage的代码的属性..
function saveValuesInLocalStorage(productUrl, productName , productImageName , vendorImage , fixedPrice, finalPrice, authorName,sharingUrl){
localStorage.sharingUrl = sharingUrl;
localStorage.productUrl = productUrl;
localStorage.productName = productName;
localStorage.imageName = productImageName;
localStorage.vendorImage = vendorImage;
localStorage.fixedPrice = fixedPrice;
localStorage.finalPrice = finalPrice;
localStorage.authorName = authorName;
}
现在我想删除ID为的那个li localStorage.productUrl
和对话页面:
<div data-role="content" data-theme="a">
<ul name="options" id="options" data-role="listview">
<li>
<a href="#" data-theme="a" data-ajax="false" onClick=" removeInfoDatabase()">
<p><span id="itemName"><h4>Remove from wish List</h4></span></p>
</a>
</li>
<li>
<a href="javascript:void(0);" data-theme="a" data-ajax="false" onclick="openWebLink()">
<p><span id="itemName"><h4>Go to Store</h4></span></p>
</a>
</li>
</ul>
</div>
下面的代码是显示了PhoneGap的SQLite的代码。 和removeInfoDatabase()函数是..
function removeInfoDatabase(){
db.transaction(removeElement, removeError, removeSuccess);
}
function removeError(err){
console.log("Error processing SQL: "+err.code);
alert("couldn't remove from wish list");
}
function removeSuccess(){
var elem =document.getElementById(localStorage.productUrl);
elem.parentNode.removeChild(elem);
// $("#"+localStorage.producturl).remove();
// var mm = $("#"+localStorage.producturl).html();
// alert(""+mm);
$("#wishList").listview("refresh");
alert("item is removed successfully");
history.back();
}
function removeElement(tx){
tx.executeSql('CREATE TABLE IF NOT EXISTS itemDetail (id unique, productName , imageName, vendorImageName , fixedPrice , finalPrice , authorName , sharingUrl)');
tx.executeSql('DELETE from itemDetail where id="'+localStorage.productUrl+'"');
}
现在我怎么CAL删除点击删除愿望清单里 请帮我之后心愿列表里..请 在此先感谢..
对此我们无能为力。提供详细信息,代码示例和测试用例。 –
这两个页面在同一个网站上? – Alnitak
@BramVanroy当然我们可以用这个做点什么! – Alnitak