zoukankan      html  css  js  c++  java
  • Javascript检测到你的分辨率,字号自动设置

    http://www.cnblogs.com/sink_cup/archive/2010/12/16/javascript_screen_width.html


    Javascript检测到你的分辨率,字号自动设置
     
    window.onresize

    <!--PageBeginHtml Block Begin-->
    <script type="text/javascript">
    function changeFontSize()
    {
      var font_size = screen.width / 64 + 'px';
      document.body.style.fontSize = font_size;
      if(document.getElementById('font_size')==null)
      {
         var pNode = document.createElement("p");
         pNode.id = 'font_size';
         document.body.insertBefore(pNode,document.body.childNodes[0]);
      }
      else
      {
         pNode=document.getElementById('font_size');
      }
        pNode.style.cssText = 'margin:0;background:#FFFFE1;border-bottom:1px solid #666666;';
        pNode.innerHTML = "Javascript检测到你的分辨率为" + screen.width + 'x' + screen.height + ',' + '字号自动设置为' + font_size;
    }
    changeFontSize();
    window.onresize=function()
    {
       changeFontSize();
    }
    </script>
  • 相关阅读:
    Linux I/O调度
    集群心跳机制
    如何修改集群的公网信息(包括 VIP) (文档 ID 1674442.1)
    AVL树(平衡二叉树)
    二叉搜索树
    二叉树及树的遍历
    python实现基数排序
    python之迷宫BFS
    python之迷宫DFS
    python实现队列
  • 原文地址:https://www.cnblogs.com/hakuci/p/2334055.html
Copyright © 2011-2022 走看看