You are here: Reference > JavaScript > client-side > ActiveX > HtmlDlgSafeHelper objects > objects > fonts

fonts collection

Browser support:
Represents a collection of all available fonts in the current system.


Properties that reference the object:

Possible members:

Returns an integer that specifies the number of available fonts.

This property is read-only.
item (index)
Returns the name of a font by index.


Required. Integer that specifies the position of the font to retrieve. The index of the first element is 1.

Return value:

Returns a string that contains the name of the font at the specified position.

Example HTML code 1:

This example illustrates the use of the fonts collection:
    <script type="text/javascript">
        function ShowFonts () {
            var dlgHelper = document.getElementById ("dlgHelper");

            if (dlgHelper.fonts) {      // Internet Exlporer
                var fontList = "";
                for (var i = 1; i < dlgHelper.fonts.Count; i++) {
                    if (i > 1) {
                        fontList += ", ";
                    fontList += dlgHelper.fonts (i);
                alert ("The number of fonts is " + dlgHelper.fonts.Count);
                alert ("The available system fonts:\n" + fontList);
            else {
                alert ("Your browser doesn't support this example!");
    <object id="dlgHelper" classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></object>
    <button onclick="ShowFonts ();">Show system fonts!</button>
Did you find this example helpful? yes no

External links:

User Contributed Comments

Post Content

Post Content