JS動態調用CSS檔案

來源:互聯網
上載者:User
<script type="text/javascript" language="javascript">
var _sn = ["df/common", "df/home2010"];
var _su = "http://www.360buy.com/skin/";
var Swidth = screen.width; var _se, _st;
for (i in _sn) {
_se = document.createElement("link");
_se.type = "text/css";
_se.rel = "stylesheet";
if (Swidth >= 1280) {
_st = _su + _sn[i] + ".w.css";
} else {
_st = _su + _sn[i] + ".css";
}
_se.href = _st;
document.getElementsByTagName("head")[0].appendChild(_se);
}
</script>
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.