<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8″>
<title>js判断手机还是pc调用不用css样式</title>
<script type=”text/javascript”>
function loadCSS() {
if((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|wOSBrowser|BrowserNG|WebOS)/i))) {
document.write(‘<link href=”css/mobile.css” rel=”stylesheet” type=”text/css” media=”screen” />’);
}
else {
document.write(‘<link href=”css/chrome.css” rel=”stylesheet” type=”text/css” media=”screen” />’);
}
}
loadCSS();
</script>
</head>
<body>
</body>
</html>