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>
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>