js 控制 head 元素 隐藏与显示

就把那段script加到head之间。
<script type="text/javascript">if(screen.width<=1240){document.write("<link rel='stylesheet' type='text/css' href='css/index_1240.css' />");}</script>

DOM中document对象的write方法,将一段HTML代码或是一段文本内容输出到文档,以使浏览器可以动态处理.

posted @ 2014-08-31 14:51  阿窟窿  阅读(471)  评论(0编辑  收藏  举报