Monday, August 25, 2008

How to change the font attributes dynamically using Javascript?

HTML code example:

<div align="center">
<font size="2" face="Times New Roman" color="#000000" id="field1"> Field Lable </font></p>
</div>

In the input box, you could call the function ChangeFont(size)

<SCRIPT LANGUAGE="JavaScript">
<!-- Heres the code to change the font
function ChangeFont(size)
{
text2.style.fontFamily="Arial";
text2.style.fontSize=size;
}-->
</SCRIPT>

No comments: