Font Property
The Font property contains the font of the displayed text.
Syntax
document.all["id_name"].Font [=IFontDisp]
|
Possible Values
IFontDisp that specifies or retrieves the font for the text.
|
The property is read/write.
Remarks
Since the Font property is an IFontDisp interface, access to the properties of the interface is possible. They are as follows:
Name, Size, Bold, Italic, Underline, Strikethrough, Weight and Charset.
Examples
The following example creates a StaticText ActiveX Control to demonstrate the possibilities. In this case the font name will be changed after 10 seconds and the text be displayed with the new font.
<html>
<head>
<SCRIPT TYPE="text/javascript">
function changeFont()
{
if(document.all["id_StaticText"].Font.Name ==
"Times New Roman")
{
document.all["id_StaticText"].Font.Name = "Arial";
document.all["id_StaticText"].Text =
document.all["id_StaticText"].Text;
}
else
{
document.all["id_StaticText"].Font.Name =
"Times New Roman";
document.all["id_StaticText"].Text =
document.all["id_StaticText"].Text;
}
}
</SCRIPT>
</head>
<body>
<OBJECT id="id_StaticText" width="170" height="12"
style="padding:0; margin:0; display:inline;"
classid="CLSID:2D6F85AB-07AB-4417-85E3-7F2400474A63">
<PARAM NAME="BackStyle" VALUE="0">
<PARAM NAME="BackColor" VALUE="0">
<PARAM NAME="FontName" VALUE="Times New Roman">
<PARAM NAME="FontSize" VALUE="8.00">
<PARAM NAME="FontBold" VALUE="0">
<PARAM NAME="FontItalic" VALUE="0">
<PARAM NAME="FontUnderline" VALUE="0">
<PARAM NAME="FontWeight" VALUE="500">
<PARAM NAME="ForeColor" VALUE="0">
<PARAM NAME="Text" VALUE="Default text if necessary">
</OBJECT>
<div onclick="changeFont()">Click to change fonts!</div>
</body>
</html>
|
Applies to
SiteKiosk v5.0 (and later versions).
Back to top