当前位置:编程学习 > JAVA >>

javascript查看页面引用什么CSS文件

var cssStyle = document.styleSheets;
        for (var i = 0; i < cssStyle.length; i++) {
            if (cssStyle[i].href != null) {
                var csshref = cssStyle[i].href;
                if (csshref.indexOf("blue") > 0) {
                    tmpcssColor = "#F5FAFF";
                    break;
                }
                else if (csshref.indexOf("default") > 0) {
                    tmpcssColor = "#FFF8E8";
                    break;
                }
                else if (csshref.indexOf("green") > 0) {
                    tmpcssColor = "#F4FAF0";
                    break;
                }
            }
        }

 

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,