19
我正在尝试为我的网站创建页面主题功能。我想使用单独的CSS文件在页面上动态加载相应的主题。动态加载CSS
我使用这个代码:
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", 'link.css')
document.getElementsByTagName("head")[0].appendChild(fileref)
,工作正常,但如果CSS文件加载或没有它不返回任何信息。
加载.css
时有没有办法捕获?也许通过使用Ajax?
看到有用的链接在这里http://www.cssnewbie.com/simple-jquery-stylesheet-switcher/ – 2010-09-19 02:21:05