我已经为循环生成的每个div分配了用户名的id。这可以。每个div /按钮都有用户名作为其标识。但是,使用这里的示例Load content of a div on another page和其他帖子我试图将该div及其内容发送到另一个页面,并传递名称值。尽管警报提醒姓名,但我的尝试仍无效。我正确地传递了价值吗?如何在下一页重新创建div?最后,这甚至是正确的方法,因为最终我想要将一张桌子贴在这个人身上。啰嗦了吗?
identity = results.rows.item(i).username;
userDiv.id = identity;
console.log(identity);
(function (identity) {
userDiv.addEventListener("click",
function () {
window.open("whatever.html");
$('#singleUser').load('index.html #userDiv');
//var singleUser = document.getElementById("singleUser");
//singleUser.appendChild(userDiv);
alert(identity);
console.log(identity);
}, false);
})(identity);