<script language="JavaScript" type="text/javascript"> if (someCondition) { document.write('<link href="mobile.css" rel="stylesheet" type="text/css" />') } </script>