PDA

View Full Version : Help with setting font color in table



halfmyself
05-18-2006, 12:46 AM
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>

jscheuer1
05-18-2006, 06:09 PM
Get rid of this:


document.write("<font face=Dalila>");

Add an id to your table:


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:


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