0

我已经为循环生成的每个 div 分配了用户名的 id。这可以。每个 div/button 都有用户名作为它的标识。但是,使用此处的示例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);
4

0 回答 0