f-l-y

方式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>标签之间添加内容

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-07-18
  • 2022-01-15
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
猜你喜欢
  • 2021-07-04
  • 2021-12-09
  • 2022-01-07
  • 2022-01-18
  • 2021-12-14
  • 2022-01-19
  • 2022-12-23
相关资源
相似解决方案