css动态样式

一种

var style=document.createElement("style");
style.type="text/css";
style.appendChild(document.createTextNode("body{background-color:red}"));
var head=document.head;
head.appendChild(style);

 

posted on 2016-09-12 23:14  Kooing  阅读(522)  评论(0编辑  收藏  举报

导航