下面是我给大家整理的如何在js中创建div,span,label,有兴趣的同学可以去看看。
var newdiv=document.createElement("div");
newdiv.className="switch-animate switch-on"
newdiv.id="switch_div"
document.getElementById("dhcpd_div").appendChild(newdiv);
var rinput = document.createElement("input");
rinput.setAttribute("type","checkbox");
rinput.setAttribute("name","dhcpd_name");
rinput.setAttribute("id",'dhcpd');
document.getElementById('switch_div').appendChild(rinput);
rinput.setAttribute("checked",'checked');
var spanON = document.createElement("span");
spanON.className = "switch-left switch-success";
spanON.innerHTML = "ON";
document.getElementById("switch_div").appendChild(spanON);
var label_var = document.createElement("label");
label_var.innerHTML = " ";
document.getElementById("switch_div").appendChild(label_var);
var spanOFF = document.createElement("span");
spanOFF.className = "switch-right switch-warning";
spanOFF.innerHTML = "OFF";
document.getElementById("switch_div").appendChild(spanOFF);
上面是我整理给大家的如何在js中创建div,span,label,希望今后会对大家有帮助。
相关文章:
以上就是通过代码详细为你讲解如何在js中创建div,span,label的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号