根据不同浏览器:
<script type="text/javascript">
var version = navigator.userAgent;
if (version.indexOf("MSIE") > 1) {
document.write("<link href='ie.css' rel='stylesheet' type='text/css'/>");
} else if (version.indexOf("Chrome") > 1) {
document.write("<link href='chrome.css' rel='stylesheet' type='text/css'/>");
} else if (version.indexOf("Firefox") > 1) {
document.write("<link href='ff.css' rel='stylesheet' type='text/css'/>");
}
</script>
根据不同分辨率:
<script type="text/javascript">
if (screen.width == 1024){
document.write("<link href='css/css1.css' rel='stylesheet' type='text/css'/>");
}else {
document.write("<link href='css/css2.css' rel='stylesheet' type='text/css'/>");}
</script>