js动态创建link
jquery写法兼容性不错
<script>
var link = document.createElement('link');
$(link).attr('rel','stylesheet');
$(link).attr('type','text/css');
$(link).attr('href','/platform/static/largedata/desktop/css/index.css');
document.getElementsByTagName('head')[0].appendChild(link)
</script>
以下这种写法也可以的
<script>
var link = document.createElement('link');
link.setAttribute('rel','stylesheet');
link.setAttribute('type','text/css');
link.setAttribute('href','/platform/static/largedata/desktop/css/index.css');
document.getElementsByTagName('head')[0].appendChild(link)
</script>
相关推荐
NARUTOLUOLUO 2020-08-03
qiupu 2020-11-04
多读书读好书 2020-11-03
RedCode 2020-10-28
jiedinghui 2020-10-25
Ladyseven 2020-10-22
hellowzm 2020-10-12
zuncle 2020-09-28
Ladyseven 2020-09-11
jiedinghui 2020-09-07
xiaohuli 2020-09-02
葉無聞 2020-09-01
impress 2020-08-26
ThikHome 2020-08-24
nicepainkiller 2020-08-20
hellowzm 2020-08-18