Home >Web Front-end >HTML Tutorial >I have two CSS files. According to different screens, how can I use JS to control their import? _html/css_WEB-ITnose

I have two CSS files. According to different screens, how can I use JS to control their import? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:14:211266browse

I have two CSS files a.css and b.css

How to use JS statements to control the import into the page according to different conditions?


Reply to discussion (solution)

if(xxx){  document.write("<link href='a.css' ..... />");}else{  document.write("<link href='b.css' ..... />");}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn