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/ ]
  • 相关阅读:
    Unity Ply网格读取
    LoadLibrary加载dll失败
    Anaconda引起cuda MSB3721 with return error code 1
    STL 如何对STL进行扩展,简单小结
    集群环境准备(Centos7)
    MySQL中的常见函数
    Mysql优化_第十三篇(HashJoin篇)
    docker创建和使用mysql
    JNI相关笔记 [TOC]
    选择排序
  • 原文地址:https://www.cnblogs.com/zjfree/p/2219230.html
Copyright © 2011-2022 走看看