问答详情
源自:2-3 HTML5存储之indexedDB的实际操作

怎么没有把rander函数这段代码展开?

怎么没有把rander这段代码展开?

提问者:menghan126 2015-04-14 12:23

个回答

  • 盛开wsk
    2016-03-30 20:14:13

    我的Render函数是自己写的,你可以读一下,希望能帮到你!

    function render(opt){

    var child_node = document.createElement("div");

    var child_node_child1 = document.createElement("div");

    var child_node_child2 = document.createElement("div");

    var child_node_child3 = document.createElement("div");

    var child_node_child4 = document.createElement("div");

    child_node_child1.setAttribute("class","table_child");

    child_node_child2.setAttribute("class","table_child");

    child_node_child3.setAttribute("class","table_child");

    child_node_child4.setAttribute("class","table_child");

    child_node_child1.setAttribute("style","float:left");

    child_node_child2.setAttribute("style","float:left");

    child_node_child3.setAttribute("style","float:left");

    child_node_child4.setAttribute("style","float:left");

    child_node_child1.innerHTML = name;

    child_node_child2.innerHTML = opt.phone;

    child_node_child3.innerHTML = opt.address;

    child_node_child4.innerHTML = "<input type='button' value='删除'>"

    child_node.appendChild(child_node_child1);

    child_node.appendChild(child_node_child2);

    child_node.appendChild(child_node_child3);

    child_node.appendChild(child_node_child4);

    child_node.setAttribute("class","table_tr");

    child_node.setAttribute("id",opt.key);

    var content = document.getElementById('content');

    content.appendChild(child_node)


    }