方式1:
var MyDiv =document.getElementById("div_id");
var button = document.createElement("input");
button.setAttribute("type", "button");
button.setAttribute("value", value);
button.setAttribute("id", id);
button.setAttribute("class", class);
button.style.width = "12%";
button.setAttribute("onclick", "function(this.id)");
MyDiv.appendChild(button);
方式2:
var button = "<a role='button' id="+jinfo[i].id+" onclick='function(this.id)'><i class='icon-edit'></i></a>";
MyDiv.innerHTML += button;
//第二种方式方便往<a></a>标签之间添加内容