我想创建多个canvas元素,每个元素都有一个id。最好的方法是什么?寻找一个vanilla javascript解决方案。var parent = document.createElement("parent");var mycanvas1 = document.createElement("canvas");mycanvas.id = "students";document.getElementById("parent").appendChild(mycanvas1);var mycanvas2 = document.createElement("canvas");mycanvas.id = "classBadge";document.getElementById("parent").appendChild(mycanvas2);var mycanvas3 = document.createElement("canvas");mycanvas.id = "classMaster";document.getElementById("parent").appendChild(mycanvas3);
添加回答
举报
0/150
提交
取消