Results 1 to 2 of 2

Thread: Help with setting font color in table

  1. #1
    Join Date
    May 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with setting font color in table

    I have created a section of javascript that tells you how much freespace is left on your drives. I plan to use this in a web page & then set the page as my desktop. This information is shown in a table and i can just about change the font but i cant for the life of my work out why i cant seem to change the font color or size. Any help would be greatly appreciated.
    Here is the code:

    <html>

    <head>
    <body bgcolor="black">

    </body>
    <script id="clientEventHandlersJS" language="javascript">


    <!--

    function Drive() {
    var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
    var service = locator.ConnectServer(".");
    var properties = service.ExecQuery("SELECT * FROM Win32_LogicalDisk");
    var e = new Enumerator (properties);
    document.write("<font face=Dalila>");

    document.write("<table border=1, bordercolor=#000000 cellpadding=0, cellspacing=0,align=right>");

    dispHeading();
    for (;!e.atEnd();e.moveNext ())
    {
    var p = e.item ();
    document.write("<tr>");
    document.write("<td>" + p.Name + "</td>");
    document.write("<td>" + p.Size + "</td>");
    document.write("<td>" + p.FreeSpace + "</td>");
    document.write("</tr>");
    }
    document.write("</table>");
    }

    function dispHeading()
    {
    document.write("<thead>");
    document.write("<td>Drive</td>");
    document.write("<td>Size (bytes)</td>");
    document.write("<td>Free (bytes)</td>");
    document.write("</thead>");
    }
    Drive();
    //-->
    </script>

    </head>
    </html>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Get rid of this:

    Code:
    document.write("<font face=Dalila>");
    Add an id to your table:

    Code:
    document.write("<table id='dsize' border=1, bordercolor=#000000 cellpadding=0, cellspacing=0,align=right>");
    You can then put a stylesheet in the head of your page to control the style of the table and its elements, ex:

    Code:
    <style type="text/css">
    #dsize td {
    font-family:Dalila;
    font-size:10pt;
    font-color:red;
    }
    </style>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •