【H5UI】h5动态添加多选框checkbox
<!DOCTYPE html><html>
<head>
<meta charset=" utf-8">
<title>添加checkbox复选框</title>
<script type="text/javascript">
var oCheckbox=document.createElement("input");
var myText=document.createTextNode("蚂蚁部落");
oCheckbox.setAttribute("type","checkbox");
oCheckbox.setAttribute("id","mayi");
window.onload=function(){
var mydiv=document.getElementById("mydiv");
mydiv.appendChild(oCheckbox);
mydiv.appendChild(myText);
}
</script>
</head>
<body>
<div id="mydiv"></div>
</body>
</html>
页:
[1]