zoukankan      html  css  js  c++  java
  • IE下获取所有客户端字体,设置背景色 PHP

    此功能只可在IE下使用。

    博客园不提供使用 OBJECT 所以就无法在线演示了。

    代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title>无标题页</title>
    </head>
    <body>
    <OBJECT id="dlgHelper" CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px">
    </OBJECT>
    <input type="button" value="获取所有字体" onclick="getFont();" />
    <input type="button" value="设置背景色" onclick="callColorDlg();" />
    <script type="text/javascript">
    function getFont()
    {
    var a=dlgHelper.fonts.count;
    alert(a);
    //show total number of system fonts
    for (i = 1;i < dlgHelper.fonts.count;i++)
    {
    var f= f + " " + dlgHelper.fonts(i)
    }
    alert(f);
    //show names of all system fonts
    }

    var sInitColor = null;
    function callColorDlg(){

    if (sInitColor == null)
    var sColor = dlgHelper.ChooseColorDlg();
    else
    var sColor = dlgHelper.ChooseColorDlg(sInitColor);

    sColor
    = sColor.toString(16);
    if (sColor.length < 6) {
    var sTempString = "000000".substring(0,6-sColor.length);
    sColor
    = sTempString.concat(sColor);
    }
    sInitColor
    = sColor;
    document.body.style.backgroundColor
    = '#' + sColor;
    }

    </script>
    </body>
    </html>




    欢迎转载,转载请注明:转载自[ http://www.cnblogs.com/zjfree/ ]
  • 相关阅读:
    [Effective JavaScript 笔记]第54条:将undefined看做“没有值”
    [Effective JavaScript 笔记]第53条:保持一致的约定
    UDP打洞原理介绍
    Uboot启动分析之Start.S
    MMU
    linux_shell
    SSH2配置
    线程同步
    C#线程基础
    客户端服务器通讯常用的一种方法——Marshal类
  • 原文地址:https://www.cnblogs.com/zjfree/p/2219230.html
Copyright © 2011-2022 走看看